Skip to content

Commit f4c513f

Browse files
timuraudiojensmaurer
authored andcommitted
[ub] Added all missing ubdefs to bring UB annex in line with P3100R2 list (#7888)
1 parent 422e12b commit f4c513f

File tree

5 files changed

+304
-135
lines changed

5 files changed

+304
-135
lines changed

source/basic.tex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,7 +3680,7 @@
36803680
and produce a pointer value that points to that object,
36813681
if that value would result in the program having defined behavior.
36823682
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}.
36843684
If multiple such pointer values would give the program defined behavior,
36853685
it is unspecified which such pointer value is produced.
36863686

@@ -3924,27 +3924,27 @@
39243924
if the pointer were of type \tcode{\keyword{void}*} is
39253925
well-defined. Indirection through such a pointer is permitted but the resulting lvalue may only be used in
39263926
limited ways, as described below. The
3927-
program has undefined behavior\ubdef{lifetime.outside.pointer} if:
3927+
program has undefined behavior if:
39283928
\begin{itemize}
39293929
\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},
39313931
\item
39323932
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
39343934
\item
39353935
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
39373937
\item
39383938
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
39403940
is to pointer to \cv{}~\keyword{void}, or to pointer to \cv{}~\keyword{void}
39413941
and subsequently to pointer to
39423942
\cv{}~\keyword{char},
39433943
\cv{}~\tcode{\keyword{unsigned} \keyword{char}}, or
39443944
\cv{}~\tcode{std::byte}\iref{cstddef.syn}, or
39453945
\item
39463946
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}.
39483948
\end{itemize}
39493949
\begin{example}
39503950
\begin{codeblock}
@@ -3987,14 +3987,14 @@
39873987
a glvalue refers to
39883988
allocated storage\iref{basic.stc.dynamic.allocation}, and using the
39893989
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:
39913991
\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
39953995
\item the glvalue is used as the operand of a
39963996
\keyword{dynamic_cast}\iref{expr.dynamic.cast} or as the operand of
3997-
\keyword{typeid}.
3997+
\keyword{typeid}\ubdef{lifetime.outside.glvalue.dynamic.cast}.
39983998
\end{itemize}
39993999

40004000
\begin{note}

source/classes.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6191,15 +6191,15 @@
61916191
indirectly derive from
61926192
\tcode{B}
61936193
shall have started and the destruction of these classes shall not have
6194-
completed, otherwise the conversion results in undefined behavior.
6194+
completed, otherwise the conversion results in undefined behavior\ubdef{class.cdtor.convert.pointer}.
61956195
To form a pointer to (or access the value of) a direct non-static member of
61966196
an object
61976197
\tcode{obj},
61986198
the construction of
61996199
\tcode{obj}
62006200
shall have started and its destruction shall not have completed,
62016201
otherwise the computation of the pointer value (or accessing the member
6202-
value) results in undefined behavior\ubdef{class.cdtor.convert.or.form.pointer}.
6202+
value) results in undefined behavior\ubdef{class.cdtor.form.pointer}.
62036203
\begin{example}
62046204
\begin{codeblock}
62056205
struct A { };

source/expressions.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@
10181018
\end{note}
10191019
If the value being converted is
10201020
outside the range of values that can be represented, the behavior is undefined.
1021-
% \ubdef{conv.fpint.int.not.represented}
1021+
\ubdef{conv.fpint.int.not.represented}
10221022
If the
10231023
source type is \keyword{bool}, the value \keyword{false} is converted to zero and the value
10241024
\keyword{true} is converted to one.
@@ -4486,14 +4486,14 @@
44864486
that is
44874487
within its lifetime or
44884488
within its period of construction or destruction\iref{class.cdtor},
4489-
the behavior is undefined.
4489+
the behavior is undefined.\ubdef{expr.dynamic.cast.pointer.lifetime}
44904490
If \tcode{v} is a glvalue of type \tcode{U} and
44914491
\tcode{v} does not refer to an object
44924492
whose type is similar to \tcode{U} and
44934493
that is
44944494
within its lifetime or
44954495
within its period of construction or destruction,
4496-
the behavior is undefined.\ubdef{expr.dynamic.cast.lifetime}
4496+
the behavior is undefined.\ubdef{expr.dynamic.cast.glvalue.lifetime}
44974497

44984498
\pnum
44994499
If \tcode{T} is ``pointer to \cv{} \keyword{void}'', then the result
@@ -6427,7 +6427,7 @@
64276427
element of the array created by that \grammarterm{new-expression}.
64286428
Zero-length arrays do not have a first element.
64296429
\end{footnote}
6430-
If not, the behavior is undefined.
6430+
If not, the behavior is undefined\ubdef{expr.delete.array.mismatch}.
64316431
\begin{note}
64326432
This means that the syntax of the \grammarterm{delete-expression} must
64336433
match the type of the object allocated by \keyword{new}, not the syntax of the

source/ifndr.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
\pnum
4040
\ifndrxref{basic.def.odr.exact.one.def} \\
4141
Every program shall contain exactly one definition of every non-inline function or variable that is odr-used in
42-
that program outside of a discarded statement \iref{stmt.if}; no diagnostic required.
42+
that program outside of a discarded statement\iref{stmt.if}; no diagnostic required.
4343

4444
\pnum
4545
\begin{example}
@@ -59,7 +59,7 @@
5959
\pnum
6060
\ifndrxref{basic.def.odr.unnamed.enum.same.type} \\
6161
If, at any point in the program, there is more than one reachable unnamed enumeration definition in the same scope that have
62-
the same first enumerator name and do not have typedef names for linkage purposes \iref{dcl.enum}, those unnamed enumeration
62+
the same first enumerator name and do not have typedef names for linkage purposes\iref{dcl.enum}, those unnamed enumeration
6363
types shall be the same; no diagnostic required.
6464

6565

0 commit comments

Comments
 (0)