Created on 2009-02-10.00:00:00 last changed 178 months ago
[Voted into the WP at the July, 2009 meeting as part of N2927.]
Proposed resolution (July, 2009)
See document PL22.16/09-0117 = WG21 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 }
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | status: wp -> cd2 |
2009-11-08 00:00:00 | admin | set | status: dr -> wp |
2009-08-03 00:00:00 | admin | set | messages: + msg2247 |
2009-08-03 00:00:00 | admin | set | status: review -> dr |
2009-03-23 00:00:00 | admin | set | messages: + msg1916 |
2009-02-10 00:00:00 | admin | create |