|
3504 | 3504 | and produce a pointer value that points to that object,
|
3505 | 3505 | if that value would result in the program having defined behavior.
|
3506 | 3506 | If no such pointer value would give the program defined behavior,
|
3507 |
| -the behavior of the program is undefined. |
| 3507 | +the behavior of the program is undefined\ubdef{intro.object.implicit.pointer}. |
3508 | 3508 | If multiple such pointer values would give the program defined behavior,
|
3509 | 3509 | it is unspecified which such pointer value is produced.
|
3510 | 3510 |
|
|
3748 | 3748 | if the pointer were of type \tcode{\keyword{void}*} is
|
3749 | 3749 | well-defined. Indirection through such a pointer is permitted but the resulting lvalue may only be used in
|
3750 | 3750 | limited ways, as described below. The
|
3751 |
| -program has undefined behavior\ubdef{lifetime.outside.pointer} if: |
| 3751 | +program has undefined behavior if: |
3752 | 3752 | \begin{itemize}
|
3753 | 3753 | \item
|
3754 |
| - the pointer is used as the operand of a \grammarterm{delete-expression}, |
| 3754 | + the pointer is used as the operand of a \grammarterm{delete-expression}\ubdef{lifetime.outside.pointer.delete}, |
3755 | 3755 | \item
|
3756 | 3756 | the pointer is used to access a non-static data member or call a
|
3757 |
| - non-static member function of the object, or |
| 3757 | + non-static member function of the object\ubdef{lifetime.outside.pointer.member}, or |
3758 | 3758 | \item
|
3759 | 3759 | the pointer is implicitly converted\iref{conv.ptr} to a pointer
|
3760 |
| - to a virtual base class, or |
| 3760 | + to a virtual base class\ubdef{lifetime.outside.pointer.virtual}, or |
3761 | 3761 | \item
|
3762 | 3762 | the pointer is used as the operand of a
|
3763 |
| - \keyword{static_cast}\iref{expr.static.cast}, except when the conversion |
| 3763 | + \keyword{static_cast}\iref{expr.static.cast}\ubdef{lifetime.outside.pointer.static.cast}, except when the conversion |
3764 | 3764 | is to pointer to \cv{}~\keyword{void}, or to pointer to \cv{}~\keyword{void}
|
3765 | 3765 | and subsequently to pointer to
|
3766 | 3766 | \cv{}~\keyword{char},
|
3767 | 3767 | \cv{}~\tcode{\keyword{unsigned} \keyword{char}}, or
|
3768 | 3768 | \cv{}~\tcode{std::byte}\iref{cstddef.syn}, or
|
3769 | 3769 | \item
|
3770 | 3770 | the pointer is used as the operand of a
|
3771 |
| - \keyword{dynamic_cast}\iref{expr.dynamic.cast}. |
| 3771 | + \keyword{dynamic_cast}\iref{expr.dynamic.cast}\ubdef{lifetime.outside.pointer.dynamic.cast}. |
3772 | 3772 | \end{itemize}
|
3773 | 3773 | \begin{example}
|
3774 | 3774 | \begin{codeblock}
|
|
3811 | 3811 | a glvalue refers to
|
3812 | 3812 | allocated storage\iref{basic.stc.dynamic.allocation}, and using the
|
3813 | 3813 | properties of the glvalue that do not depend on its value is
|
3814 |
| -well-defined. The program has undefined behavior\ubdef{lifetime.outside.glvalue} if: |
| 3814 | +well-defined. The program has undefined behavior if: |
3815 | 3815 | \begin{itemize}
|
3816 |
| -\item the glvalue is used to access the object, or |
3817 |
| -\item the glvalue is used to call a non-static member function of the object, or |
3818 |
| -\item the glvalue is bound to a reference to a virtual base class\iref{dcl.init.ref}, or |
| 3816 | +\item the glvalue is used to access the object\ubdef{lifetime.outside.glvalue.access}, or |
| 3817 | +\item the glvalue is used to call a non-static member function of the object\ubdef{lifetime.outside.glvalue.member}, or |
| 3818 | +\item the glvalue is bound to a reference to a virtual base class\iref{dcl.init.ref}\ubdef{lifetime.outside.glvalue.virtual}, or |
3819 | 3819 | \item the glvalue is used as the operand of a
|
3820 | 3820 | \keyword{dynamic_cast}\iref{expr.dynamic.cast} or as the operand of
|
3821 |
| -\keyword{typeid}. |
| 3821 | +\keyword{typeid}\ubdef{lifetime.outside.glvalue.dynamic.cast}. |
3822 | 3822 | \end{itemize}
|
3823 | 3823 |
|
3824 | 3824 | \begin{note}
|
|
0 commit comments