Skip to content

Commit aaaf8ae

Browse files
committed
[basic.def.odr] Clarify the meaning of the set of potential results of
an expression and how that relates to odr-use.
1 parent cf23c2d commit aaaf8ae

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

source/basic.tex

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,26 @@
270270
contains the potential results of the right operand.
271271
\item Otherwise, the set is empty.
272272
\end{itemize}
273+
\enternote
274+
This set is a (possibly-empty) set of \grammarterm{id-expression}{s},
275+
each of which is either \tcode{e} or a subexpression of \tcode{e}.
276+
\enterexample
277+
In the following example, the set of potential results of the initializer
278+
of \tcode{n} contains the first \tcode{S::x} subexpression, but not the second
279+
\tcode{S::x} subexpression.
280+
\begin{codeblock}
281+
struct S { static const int x = 0; };
282+
int f(const int &r);
283+
int n = b ? (1, S::x) // \tcode{S::x} is not odr-used here
284+
: f(S::x); // \tcode{S::x} is odr-used here, so
285+
// a definition is required
286+
\end{codeblock}
287+
\exitexample
288+
\exitnote
273289

274290
\pnum
275291
A variable \tcode{x} whose name appears as a
276-
potentially-evaluated expression \tcode{ex} is \defn{odr-used} unless
292+
potentially-evaluated expression \tcode{ex} is \defn{odr-used} by \tcode{ex} unless
277293
applying the lvalue-to-rvalue conversion (\ref{conv.lval}) to \tcode{x} yields
278294
a constant expression~(\ref{expr.const}) that does not invoke any non-trivial
279295
functions

0 commit comments

Comments
 (0)