|
645 | 645 | \pnum
|
646 | 646 | Every program shall contain at least one definition of every
|
647 | 647 | function or variable that is odr-used in that program
|
648 |
| -outside of a discarded statement\iref{stmt.if}; no diagnostic required. |
| 648 | +outside of a discarded statement\iref{stmt.if}; no diagnostic required\ifndrdef{basic.def.odr.exact.one.def}. |
649 | 649 | The definition can appear explicitly in the program, it can be found in
|
650 | 650 | the standard or a user-defined library, or (when appropriate) it is
|
651 | 651 | implicitly defined (see~\ref{class.default.ctor}, \ref{class.copy.ctor},
|
|
928 | 928 | reachable unnamed enumeration definition in the same scope
|
929 | 929 | that have the same first enumerator name and
|
930 | 930 | do not have typedef names for linkage purposes\iref{dcl.enum},
|
931 |
| -those unnamed enumeration types shall be the same; no diagnostic required. |
| 931 | +those unnamed enumeration types shall be the same; no diagnostic required\ifndrdef{basic.def.odr.unnamed.enum.same.type}. |
932 | 932 | \indextext{one-definition rule|)}
|
933 | 933 |
|
934 | 934 | \rSec1[basic.scope]{Scope}%
|
|
1803 | 1803 | If it is an invalid set, the program is ill-formed.
|
1804 | 1804 | If it differs from the result of a search in $T$ for $M$
|
1805 | 1805 | in a complete-class context\iref{class.mem} of $T$,
|
1806 |
| -the program is ill-formed, no diagnostic required. |
| 1806 | +the program is ill-formed, no diagnostic required\ifndrdef{class.member.lookup.name.refers.diff.decl}. |
1807 | 1807 | \begin{example}
|
1808 | 1808 | \begin{codeblock}
|
1809 | 1809 | struct A { int x; }; // S(x,A) = \{ \{ \tcode{A::x} \}, \{ \tcode{A} \} \}
|
|
3662 | 3662 | zero or more objects of implicit-lifetime types\iref{term.implicit.lifetime.type}
|
3663 | 3663 | in its specified region of storage
|
3664 | 3664 | if doing so would result in the program having defined behavior.
|
3665 |
| -If no such set of objects would give the program defined behavior, |
| 3665 | +If no such set of objects would give the program defined behavior\ubdef{intro.object.implicit.create}, |
3666 | 3666 | the behavior of the program is undefined.
|
3667 | 3667 | If multiple such sets of objects would give the program defined behavior,
|
3668 | 3668 | it is unspecified which such set of objects is created.
|
|
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 if |
| 3927 | +program has undefined behavior\ubdef{lifetime.outside.pointer} if: |
3928 | 3928 | \begin{itemize}
|
3929 | 3929 | \item
|
3930 | 3930 | the pointer is used as the operand of a \grammarterm{delete-expression},
|
|
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 if |
| 3990 | +well-defined. The program has undefined behavior\ubdef{lifetime.outside.glvalue} if: |
3991 | 3991 | \begin{itemize}
|
3992 | 3992 | \item the glvalue is used to access the object, or
|
3993 | 3993 | \item the glvalue is used to call a non-static member function of the object, or
|
|
4077 | 4077 | \end{footnote}
|
4078 | 4078 | and another object of the original type does not occupy
|
4079 | 4079 | that same storage location when the implicit destructor call takes
|
4080 |
| -place, the behavior of the program is undefined. This is true |
| 4080 | +place, the behavior of the program is undefined\ubdef{original.type.implicit.destructor}. This is true |
4081 | 4081 | even if the block is exited with an exception.
|
4082 | 4082 | \begin{example}
|
4083 | 4083 | \begin{codeblock}
|
|
4097 | 4097 | Creating a new object within the storage that a const, complete
|
4098 | 4098 | object with static, thread, or automatic storage duration occupies,
|
4099 | 4099 | or within the storage that such a const object used to occupy before
|
4100 |
| -its lifetime ended, results in undefined behavior. |
| 4100 | +its lifetime ended, results in undefined behavior\ubdef{creating.within.const.complete.obj}. |
4101 | 4101 | \begin{example}
|
4102 | 4102 | \begin{codeblock}
|
4103 | 4103 | struct B {
|
|
4436 | 4436 | does not satisfy the semantic constraints
|
4437 | 4437 | specified in~\ref{basic.stc.dynamic.allocation}
|
4438 | 4438 | and~\ref{basic.stc.dynamic.deallocation},
|
4439 |
| -the behavior is undefined. |
| 4439 | +the behavior is undefined\ubdef{basic.stc.alloc.dealloc.constraint}. |
4440 | 4440 |
|
4441 | 4441 | \indextext{storage duration!dynamic|)}
|
4442 | 4442 |
|
|
6445 | 6445 | The value computations of the operands of an
|
6446 | 6446 | operator are sequenced before the value computation of the result of the
|
6447 | 6447 | operator.
|
6448 |
| -The behavior is undefined if |
| 6448 | +The behavior is undefined\iref{intro.multithread}\ubdef{intro.execution.unsequenced.modification} if |
6449 | 6449 | \begin{itemize}
|
6450 | 6450 | \item
|
6451 | 6451 | \indextext{side effects}%
|
|
6853 | 6853 | and neither happens before the other,
|
6854 | 6854 | except for the special case for signal handlers described below.
|
6855 | 6855 | Any such data race results in undefined
|
6856 |
| -behavior. |
| 6856 | +behavior\ubdef{intro.races.data}. |
6857 | 6857 | \begin{note}
|
6858 | 6858 | It can be shown that programs that correctly use mutexes
|
6859 | 6859 | and \tcode{memory_order::seq_cst} operations to prevent all data races and use no
|
|
7219 | 7219 | objects with automatic storage duration\iref{class.dtor}. If
|
7220 | 7220 | \tcode{std::exit} is invoked during the destruction of
|
7221 | 7221 | an object with static or thread storage duration, the program has undefined
|
7222 |
| -behavior. |
| 7222 | +behavior\ubdef{basic.start.main.exit.during.destruction}. |
7223 | 7223 |
|
7224 | 7224 | \pnum
|
7225 | 7225 | \indextext{termination!program}%
|
|
7513 | 7513 | \pnum
|
7514 | 7514 | If a function contains a block variable of static or thread storage duration that has been
|
7515 | 7515 | destroyed and the function is called during the destruction of an object with static or
|
7516 |
| -thread storage duration, the program has undefined behavior if the flow of control |
| 7516 | +thread storage duration, the program has undefined behavior\ubdef{basic.start.term.use.after.destruction} if the flow of control |
7517 | 7517 | passes through the definition of the previously destroyed block variable.
|
7518 | 7518 | \begin{note}
|
7519 | 7519 | Likewise, the behavior is undefined
|
|
7540 | 7540 | handlers\iref{support.runtime} that does not happen before\iref{intro.multithread}
|
7541 | 7541 | completion of destruction of objects with static storage duration and execution of
|
7542 | 7542 | \tcode{std::atexit} registered functions\iref{support.start.term}, the program has
|
7543 |
| -undefined behavior. |
| 7543 | +undefined behavior\ubdef{basic.start.term.signal.handler}. |
7544 | 7544 | \begin{note}
|
7545 | 7545 | If there is a use of an object with static storage
|
7546 | 7546 | duration that does not happen before the object's destruction, the program has undefined
|
|
0 commit comments