Skip to content

[ub] added many missing entries to UB annex #7864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: ub-ifndr
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3558,7 +3558,7 @@
using the alignment specifier\iref{dcl.align}.
Attempting to create an object\iref{intro.object} in storage that
does not meet the alignment requirements of the object's type
is undefined behavior.
is undefined behavior.\ubdef{basic.align.object.alignment}

\pnum
A \defnadj{fundamental}{alignment} is represented by an alignment
Expand Down Expand Up @@ -3973,7 +3973,7 @@
\pnum
Except in the following cases,
if an indeterminate value is produced by an evaluation,
the behavior is undefined, and
the behavior is undefined\ubdef{basic.indet.value}, and
if an erroneous value is produced by an evaluation,
the behavior is erroneous and
the result of the evaluation is the value so produced but is not erroneous:
Expand Down Expand Up @@ -4300,7 +4300,7 @@
\tcode{p0} represents the address of a block of storage disjoint from the storage
for any other object accessible to the caller.
The effect of indirecting through a pointer
returned from a request for zero size is undefined.
returned from a request for zero size is undefined.\ubdef{basic.stc.alloc.zero.dereference}
\begin{footnote}
The intent is
to have \tcode{\keyword{operator} \keyword{new}()} implementable by
Expand Down Expand Up @@ -4423,7 +4423,7 @@
signature.

\pnum
If a deallocation function terminates by throwing an exception, the behavior is undefined.
If a deallocation function terminates by throwing an exception, the behavior is undefined.\ubdef{basic.stc.alloc.dealloc.throw}
The value of the first argument supplied to a deallocation function may
be a null pointer value; if so, and if the deallocation function is one
supplied in the standard library, the call has no effect.
Expand Down Expand Up @@ -5634,7 +5634,7 @@
$P$ is not valid in the context of $E$,
then the behavior is undefined if $E$ is
an indirection\iref{expr.unary.op} or
an invocation of a deallocation function\iref{basic.stc.dynamic.deallocation},
an invocation of a deallocation function\iref{basic.stc.dynamic.deallocation}\ubdef{basic.compound.invalid.pointer},
and \impldef{invalid pointer value in the context of an evaluation} otherwise.
\begin{footnote}
Some implementations might define that
Expand Down
5 changes: 3 additions & 2 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6035,9 +6035,10 @@
\indextext{destruction!member access}%
For an object with a non-trivial constructor, referring to any non-static member
or base class of the object before the constructor begins execution results in
undefined behavior\ubdef{class.cdtor.before.ctor.after.dtor}. For an object with a non-trivial destructor, referring to
undefined behavior\ubdef{class.cdtor.before.ctor}.
For an object with a non-trivial destructor, referring to
any non-static member or base class of the object after the destructor finishes
execution results in undefined behavior.
execution results in undefined behavior\ubdef{class.cdtor.after.dtor}.
\begin{example}
\begin{codeblock}
struct X { int i; };
Expand Down
6 changes: 3 additions & 3 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3185,11 +3185,11 @@
the converted initializer is a glvalue whose
type is not call-compatible\iref{expr.call}
with the type of the function's definition
results in undefined behavior.
results in undefined behavior.\ubdef{dcl.ref.incompatible.function}
Attempting to bind a reference to an object where
the converted initializer is a glvalue through which
the object is not type-accessible\iref{basic.lval}
results in undefined behavior.
results in undefined behavior\ubdef{dcl.ref.incompatible.type}.
\begin{note}
\indextext{reference!null}%
The object designated by such a glvalue can be
Expand All @@ -3203,7 +3203,7 @@
\end{note}
The behavior of an evaluation of a reference\iref{expr.prim.id, expr.ref} that
does not happen after\iref{intro.races} the initialization of the reference
is undefined.
is undefined.\ubdef{dcl.ref.uninitialized.reference}
\begin{example}
\begin{codeblock}
int &f(int&);
Expand Down
29 changes: 16 additions & 13 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
a defaulted copy/move constructor or copy/move assignment operator
for a union of type \tcode{U} with a glvalue argument
that does not denote an object of type \cv{}~\tcode{U} within its lifetime,
the behavior is undefined.
the behavior is undefined.\ubdef{expr.basic.lvalue.union.initialization}
\begin{note}
In C, an entire object of structure type can be accessed, e.g., using assignment.
By contrast, \Cpp{} has no notion of accessing an object of class type
Expand All @@ -341,7 +341,7 @@
If a pointer to $X$ would be valid in
the context of the evaluation of the expression\iref{basic.fundamental},
the result designates $X$;
otherwise, the behavior is undefined.
otherwise, the behavior is undefined.\ubdef{expr.type.reference.lifetime}
\begin{note}
Before the lifetime of the reference has started or after it has ended,
the behavior is undefined (see~\ref{basic.life}).
Expand Down Expand Up @@ -680,7 +680,7 @@

\item Otherwise, if the bits in the value representation of
the object to which the glvalue refers
are not valid for the object's type, the behavior is undefined.
are not valid for the object's type, the behavior is undefined.\ubdef{conv.lval.valid.representation}
\begin{example}
\begin{codeblock}
bool f() {
Expand Down Expand Up @@ -997,7 +997,7 @@
integer type. The conversion truncates; that is, the fractional part is
discarded.
\indextext{value!undefined unrepresentable integral}%
The behavior is undefined\ubdef{conv.fpint.not.represented} if the truncated value cannot be represented
The behavior is undefined\ubdef{conv.fpint.float.not.represented} if the truncated value cannot be represented
in the destination type.
\begin{note}
If the destination type is \keyword{bool}, see~\ref{conv.bool}.
Expand All @@ -1018,7 +1018,8 @@
exactly as a value of the floating-point type.
\end{note}
If the value being converted is
outside the range of values that can be represented, the behavior is undefined. If the
outside the range of values that can be represented, the behavior is undefined.\ubdef{conv.fpint.int.not.represented}
If the
source type is \keyword{bool}, the value \keyword{false} is converted to zero and the value
\keyword{true} is converted to one.

Expand Down Expand Up @@ -1070,7 +1071,7 @@
that is
within its lifetime or
within its period of construction or destruction\iref{class.cdtor},
the behavior is undefined.
the behavior is undefined.\ubdef{conv.ptr.virtual.base}
Otherwise,
the result is a pointer to the base class subobject of
the derived class object.
Expand Down Expand Up @@ -1104,7 +1105,8 @@
\tcode{D}, a program that necessitates this conversion is ill-formed.
If class \tcode{D} does not contain the original member and
is not a base class of the class containing the original member,
the behavior is undefined. Otherwise,
the behavior is undefined.\ubdef{conv.member.missing.member}
Otherwise,
the result of the conversion refers to the same member as the pointer to
member before the conversion took place, but it refers to the base class
member as if it were a member of the derived class. The result refers to
Expand Down Expand Up @@ -4067,7 +4069,7 @@
If \tcode{E2} is a non-static member and
the result of \tcode{E1} is an object whose type
is not similar\iref{conv.qual} to the type of \tcode{E1},
the behavior is undefined\ubdef{expr.ref.not.similar}.
the behavior is undefined\ubdef{expr.ref.member.not.similar}.
\begin{example}
\begin{codeblock}
struct A { int i; };
Expand Down Expand Up @@ -4203,7 +4205,7 @@
that is
within its lifetime or
within its period of construction or destruction,
the behavior is undefined.
the behavior is undefined.\ubdef{expr.dynamic.cast.lifetime}

\pnum
If \tcode{T} is ``pointer to \cv{} \keyword{void}'', then the result
Expand Down Expand Up @@ -4549,7 +4551,7 @@
the result of the conversion is
an \impldef{result of inexact floating-point conversion} choice of
either of those values.
Otherwise, the behavior is undefined\ubdef{expr.static.cast.downcast.wrong.derived.type}.
Otherwise, the behavior is undefined\ubdef{expr.static.cast.fp.outside.range}.

\pnum
\indextext{cast!base class}%
Expand All @@ -4570,7 +4572,7 @@
``pointer to \cvqual{cv1} \tcode{B}'' points to a \tcode{B} that is
actually a base class subobject of an object of type \tcode{D}, the resulting
pointer points to the enclosing object of type \tcode{D}. Otherwise, the
behavior is undefined.
behavior is undefined\ubdef{expr.static.cast.downcast.wrong.derived.type}.

\pnum
\indextext{cast!pointer-to-member}%
Expand Down Expand Up @@ -4977,7 +4979,8 @@
The operator yields an lvalue of type \tcode{T}.
If the operand points to an object or function,
the result denotes that object or function;
otherwise, the behavior is undefined except as specified in \ref{expr.typeid}.
otherwise, the behavior is undefined except as specified in \ref{expr.typeid}
\ubdef{expr.unary.dereference}.
\begin{note}
\indextext{type!incomplete}%
Indirection through a pointer to an incomplete type (other than
Expand Down Expand Up @@ -6731,7 +6734,7 @@
\pnum
For addition or subtraction, if the expressions \tcode{P} or \tcode{Q} have
type ``pointer to \cv{}~\tcode{T}'', where \tcode{T} and the array element type
are not similar\iref{conv.qual}, the behavior is undefined\ubdef{expr.add.polymorphic}.
are not similar\iref{conv.qual}, the behavior is undefined\ubdef{expr.add.not.similar}.
\begin{example}
\begin{codeblock}
int arr[5] = {1, 2, 3, 4, 5};
Expand Down
2 changes: 2 additions & 0 deletions source/front.tex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
\let\oindex\index
\let\index\indexoff

\setcounter{tocdepth}{5}

%% Include table of contents. Do not list "Contents"
%% within it (per ISO request) but do include a
%% bookmark for it in the PDF.
Expand Down
Loading
Loading