Skip to content

Commit 9788ef3

Browse files
Dawn Perchikzygoloid
authored andcommitted
CWG2380 capture-default makes too many references odr-usable
1 parent d4f472e commit 9788ef3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

source/basic.tex

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@
437437
\begin{itemize}
438438
\item the intervening declarative region is a block scope, or
439439
\item the intervening declarative region is the function parameter scope of a \grammarterm{lambda-expression}
440-
that has a \grammarterm{simple-capture} naming the entity or has a \grammarterm{capture-default}.
440+
that has a \grammarterm{simple-capture}
441+
naming the entity or has a \grammarterm{capture-default}, and
442+
the block scope of the \grammarterm{lambda-expression}
443+
is also an intervening declarative region.
441444
\end{itemize}
442445
\end{itemize}
443446

@@ -447,11 +450,13 @@
447450
\begin{example}
448451
\begin{codeblock}
449452
void f(int n) {
450-
[] { n = 1; }; // error, \tcode{n} is not odr-usable due to intervening lambda-expression
453+
[] { n = 1; }; // error: \tcode{n} is not odr-usable due to intervening lambda-expression
451454
struct A {
452-
void f() { n = 2; } // error, \tcode{n} is not odr-usable due to intervening function definition scope
455+
void f() { n = 2; } // error: \tcode{n} is not odr-usable due to intervening function definition scope
453456
};
454-
void g(int = n); // error, \tcode{n} is not odr-usable due to intervening function parameter scope
457+
void g(int = n); // error: \tcode{n} is not odr-usable due to intervening function parameter scope
458+
[=](int k = n) {}; // error: \tcode{n} is not odr-usable due to being
459+
// outside the block scope of the \grammarterm{lambda-expression}
455460
[&] { [n]{ return n; }; }; // OK
456461
}
457462
\end{codeblock}

0 commit comments

Comments
 (0)