This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Voted into the WP at the July, 2009 meeting as part of N2927.]
Assuming that it is permitted to use a lambda as a default argument in a block-scope function declaration (see issue 754), it is presumably ill-formed for such a lambda expression to refer to a local automatic variable (9.3.4.7 [dcl.fct.default] paragraph 7). What does this mean for capture-defaults? For example,
void f() { int i = 1; void f(int = ([i]() { return i; })()); // Definitely an error void g(int = ([i]() { return 0; })()); // Probably an error void h(int = ([=]() { return i; })()); // Definitely an error void o(int = ([=]() { return 0; })()); // Okay? void p(int = ([]() { return sizeof i; })()); // Presumably okay }
Proposed resolution (July, 2009)
See document PL22.16/09-0117 = WG21 N2927.