File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 437
437
\begin {itemize }
438
438
\item the intervening declarative region is a block scope, or
439
439
\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.
441
444
\end {itemize }
442
445
\end {itemize }
443
446
447
450
\begin {example }
448
451
\begin {codeblock }
449
452
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
451
454
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
453
456
};
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}
455
460
[&] { [n]{ return n; }; }; // OK
456
461
}
457
462
\end {codeblock }
You can’t perform that action at this time.
0 commit comments