CWG Issue 1772 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-04-13
1772.__func__ in a lambda body
Section: 7.5.6 [expr.prim.lambda]Status: C++14Submitter: Switzerland/CanadaDate: 2013-09-24
N3690 comment CH 5 N3690 comment CA 22
[Moved to DR at the February, 2014 meeting.]
It is not clear whether __func__ in the body of a lambda refers to the operator() of the closure class or to the containing function (if any). Since lambdas can appear in non-function scope, it would be preferable for them to refer to the closure class's operator().
Proposed resolution (September, 2013):
Change 7.5.6 [expr.prim.lambda] paragraph 7 as follows:
The lambda-expression's compound-statement yields the function-body... —_end example_] Further, a variable __func__ is implicitly defined at the beginning of the compound-statement of the lambda-expression, with semantics as described in 9.6.1 [dcl.fct.def.general].