Skip to content

Commit c0a7e92

Browse files
burblebeetkoeppe
authored andcommitted
CWG2933 Dangling references
1 parent 18f8ef2 commit c0a7e92

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

source/basic.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5518,7 +5518,7 @@
55185518
A pointer value $P$ is
55195519
\indextext{value!valid in the context of an evaluation}%
55205520
\defn{valid in the context of} an evaluation $E$
5521-
if $P$ is a null pointer value, or
5521+
if $P$ is a pointer to function or a null pointer value, or
55225522
if it is a pointer to or past the end of an object $O$ and
55235523
$E$ happens before the end of the duration of the region of storage for $O$.
55245524
If a pointer value $P$ is used in an evaluation $E$ and

source/expressions.tex

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,13 @@
336336
\indextext{expression!reference}%
337337
If an expression initially has the type ``reference to
338338
\tcode{T}''\iref{dcl.ref,dcl.init.ref}, the type is adjusted to
339-
\tcode{T} prior to any further analysis. The expression designates the
340-
object or function denoted by the reference, and the expression
341-
is an lvalue or an xvalue, depending on the expression.
339+
\tcode{T} prior to any further analysis;
340+
the value category of the expression is not altered.
341+
Let $X$ be the object or function denoted by the reference.
342+
If a pointer to $X$ would be valid in
343+
the context of the evalution of the expression\iref{basic.fundamental},
344+
the result designates $X$;
345+
otherwise, the behavior is undefined.
342346
\begin{note}
343347
Before the lifetime of the reference has started or after it has ended,
344348
the behavior is undefined (see~\ref{basic.life}).

0 commit comments

Comments
 (0)