Skip to content

Commit 496f1bb

Browse files
authored
[ub] Added all missing ubdefs to bring UB annex in line with P3100R2 list (#7888)
1 parent 13307cb commit 496f1bb

File tree

4 files changed

+287
-118
lines changed

4 files changed

+287
-118
lines changed

source/basic.tex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3504,7 +3504,7 @@
35043504
and produce a pointer value that points to that object,
35053505
if that value would result in the program having defined behavior.
35063506
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}.
35083508
If multiple such pointer values would give the program defined behavior,
35093509
it is unspecified which such pointer value is produced.
35103510

@@ -3748,27 +3748,27 @@
37483748
if the pointer were of type \tcode{\keyword{void}*} is
37493749
well-defined. Indirection through such a pointer is permitted but the resulting lvalue may only be used in
37503750
limited ways, as described below. The
3751-
program has undefined behavior\ubdef{lifetime.outside.pointer} if:
3751+
program has undefined behavior if:
37523752
\begin{itemize}
37533753
\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},
37553755
\item
37563756
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
37583758
\item
37593759
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
37613761
\item
37623762
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
37643764
is to pointer to \cv{}~\keyword{void}, or to pointer to \cv{}~\keyword{void}
37653765
and subsequently to pointer to
37663766
\cv{}~\keyword{char},
37673767
\cv{}~\tcode{\keyword{unsigned} \keyword{char}}, or
37683768
\cv{}~\tcode{std::byte}\iref{cstddef.syn}, or
37693769
\item
37703770
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}.
37723772
\end{itemize}
37733773
\begin{example}
37743774
\begin{codeblock}
@@ -3811,14 +3811,14 @@
38113811
a glvalue refers to
38123812
allocated storage\iref{basic.stc.dynamic.allocation}, and using the
38133813
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:
38153815
\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
38193819
\item the glvalue is used as the operand of a
38203820
\keyword{dynamic_cast}\iref{expr.dynamic.cast} or as the operand of
3821-
\keyword{typeid}.
3821+
\keyword{typeid}\ubdef{lifetime.outside.glvalue.dynamic.cast}.
38223822
\end{itemize}
38233823

38243824
\begin{note}

source/classes.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6123,15 +6123,15 @@
61236123
indirectly derive from
61246124
\tcode{B}
61256125
shall have started and the destruction of these classes shall not have
6126-
completed, otherwise the conversion results in undefined behavior.
6126+
completed, otherwise the conversion results in undefined behavior\ubdef{class.cdtor.convert.pointer}.
61276127
To form a pointer to (or access the value of) a direct non-static member of
61286128
an object
61296129
\tcode{obj},
61306130
the construction of
61316131
\tcode{obj}
61326132
shall have started and its destruction shall not have completed,
61336133
otherwise the computation of the pointer value (or accessing the member
6134-
value) results in undefined behavior\ubdef{class.cdtor.convert.or.form.pointer}.
6134+
value) results in undefined behavior\ubdef{class.cdtor.form.pointer}.
61356135
\begin{example}
61366136
\begin{codeblock}
61376137
struct A { };

source/expressions.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@
10191019
\end{note}
10201020
If the value being converted is
10211021
outside the range of values that can be represented, the behavior is undefined.
1022-
% \ubdef{conv.fpint.int.not.represented}
1022+
\ubdef{conv.fpint.int.not.represented}
10231023
If the
10241024
source type is \keyword{bool}, the value \keyword{false} is converted to zero and the value
10251025
\keyword{true} is converted to one.
@@ -4199,14 +4199,14 @@
41994199
that is
42004200
within its lifetime or
42014201
within its period of construction or destruction\iref{class.cdtor},
4202-
the behavior is undefined.
4202+
the behavior is undefined.\ubdef{expr.dynamic.cast.pointer.lifetime}
42034203
If \tcode{v} is a glvalue of type \tcode{U} and
42044204
\tcode{v} does not refer to an object
42054205
whose type is similar to \tcode{U} and
42064206
that is
42074207
within its lifetime or
42084208
within its period of construction or destruction,
4209-
the behavior is undefined.\ubdef{expr.dynamic.cast.lifetime}
4209+
the behavior is undefined.\ubdef{expr.dynamic.cast.glvalue.lifetime}
42104210

42114211
\pnum
42124212
If \tcode{T} is ``pointer to \cv{} \keyword{void}'', then the result
@@ -6156,7 +6156,7 @@
61566156
element of the array created by that \grammarterm{new-expression}.
61576157
Zero-length arrays do not have a first element.
61586158
\end{footnote}
6159-
If not, the behavior is undefined.
6159+
If not, the behavior is undefined\ubdef{expr.delete.array.mismatch}.
61606160
\begin{note}
61616161
This means that the syntax of the \grammarterm{delete-expression} must
61626162
match the type of the object allocated by \keyword{new}, not the syntax of the

0 commit comments

Comments
 (0)