|
3680 | 3680 | and produce a pointer value that points to that object, |
3681 | 3681 | if that value would result in the program having defined behavior. |
3682 | 3682 | If no such pointer value would give the program defined behavior, |
3683 | | -the behavior of the program is undefined. |
| 3683 | +the behavior of the program is undefined\ubdef{intro.object.implicit.pointer}. |
3684 | 3684 | If multiple such pointer values would give the program defined behavior, |
3685 | 3685 | it is unspecified which such pointer value is produced. |
3686 | 3686 |
|
|
3924 | 3924 | if the pointer were of type \tcode{\keyword{void}*} is |
3925 | 3925 | well-defined. Indirection through such a pointer is permitted but the resulting lvalue may only be used in |
3926 | 3926 | limited ways, as described below. The |
3927 | | -program has undefined behavior\ubdef{lifetime.outside.pointer} if: |
| 3927 | +program has undefined behavior if: |
3928 | 3928 | \begin{itemize} |
3929 | 3929 | \item |
3930 | | - the pointer is used as the operand of a \grammarterm{delete-expression}, |
| 3930 | + the pointer is used as the operand of a \grammarterm{delete-expression}\ubdef{lifetime.outside.pointer.delete}, |
3931 | 3931 | \item |
3932 | 3932 | the pointer is used to access a non-static data member or call a |
3933 | | - non-static member function of the object, or |
| 3933 | + non-static member function of the object\ubdef{lifetime.outside.pointer.member}, or |
3934 | 3934 | \item |
3935 | 3935 | the pointer is implicitly converted\iref{conv.ptr} to a pointer |
3936 | | - to a virtual base class, or |
| 3936 | + to a virtual base class\ubdef{lifetime.outside.pointer.virtual}, or |
3937 | 3937 | \item |
3938 | 3938 | the pointer is used as the operand of a |
3939 | | - \keyword{static_cast}\iref{expr.static.cast}, except when the conversion |
| 3939 | + \keyword{static_cast}\iref{expr.static.cast}\ubdef{lifetime.outside.pointer.static.cast}, except when the conversion |
3940 | 3940 | is to pointer to \cv{}~\keyword{void}, or to pointer to \cv{}~\keyword{void} |
3941 | 3941 | and subsequently to pointer to |
3942 | 3942 | \cv{}~\keyword{char}, |
3943 | 3943 | \cv{}~\tcode{\keyword{unsigned} \keyword{char}}, or |
3944 | 3944 | \cv{}~\tcode{std::byte}\iref{cstddef.syn}, or |
3945 | 3945 | \item |
3946 | 3946 | the pointer is used as the operand of a |
3947 | | - \keyword{dynamic_cast}\iref{expr.dynamic.cast}. |
| 3947 | + \keyword{dynamic_cast}\iref{expr.dynamic.cast}\ubdef{lifetime.outside.pointer.dynamic.cast}. |
3948 | 3948 | \end{itemize} |
3949 | 3949 | \begin{example} |
3950 | 3950 | \begin{codeblock} |
|
3987 | 3987 | a glvalue refers to |
3988 | 3988 | allocated storage\iref{basic.stc.dynamic.allocation}, and using the |
3989 | 3989 | properties of the glvalue that do not depend on its value is |
3990 | | -well-defined. The program has undefined behavior\ubdef{lifetime.outside.glvalue} if: |
| 3990 | +well-defined. The program has undefined behavior if: |
3991 | 3991 | \begin{itemize} |
3992 | | -\item the glvalue is used to access the object, or |
3993 | | -\item the glvalue is used to call a non-static member function of the object, or |
3994 | | -\item the glvalue is bound to a reference to a virtual base class\iref{dcl.init.ref}, or |
| 3992 | +\item the glvalue is used to access the object\ubdef{lifetime.outside.glvalue.access}, or |
| 3993 | +\item the glvalue is used to call a non-static member function of the object\ubdef{lifetime.outside.glvalue.member}, or |
| 3994 | +\item the glvalue is bound to a reference to a virtual base class\iref{dcl.init.ref}\ubdef{lifetime.outside.glvalue.virtual}, or |
3995 | 3995 | \item the glvalue is used as the operand of a |
3996 | 3996 | \keyword{dynamic_cast}\iref{expr.dynamic.cast} or as the operand of |
3997 | | -\keyword{typeid}. |
| 3997 | +\keyword{typeid}\ubdef{lifetime.outside.glvalue.dynamic.cast}. |
3998 | 3998 | \end{itemize} |
3999 | 3999 |
|
4000 | 4000 | \begin{note} |
|
0 commit comments