This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
[Moved to DR at the February, 2014 meeting.]
The example in 7.5.6 [expr.prim.lambda] paragraph 24 reads,
template<class... Args> void f(Args... args) { auto lm = [&, args...] { return g(args...); }; lm(); }
However, it's not clear how this example squares with the requirements in paragraph 10,
The identifier in a simple-capture is looked up using the usual rules for unqualified name lookup (6.5.3 [basic.lookup.unqual]); each such lookup shall find a variable with automatic storage duration declared in the reaching scope of the local lambda expression.
since a function parameter pack is not a variable. Although the requirement might be met in a given specialization of the function template, is there a rule that relaxes it in the context of the function template definition?
Proposed resolution (September, 2013):
Change 7.5.6 [expr.prim.lambda] paragraph 10 as follows:
The identifier in a simple-capture is looked up using the usual rules for unqualified name lookup (6.5.3 [basic.lookup.unqual]); each such lookup shall find an entity. An entity that is designated by a simple-capture is said to be explicitly captured, and shall be this or a variable with automatic storage duration declared in the reaching scope of the local lambda expression.An entity (i.e. a variable or this) is said to be explicitly captured if it is found by this process.
Change 13.7.4 [temp.variadic] paragraph 4 as follows:
...Pack expansions can occur in the following contexts:
...
For the purpose of determining whether a parameter pack satisfies a rule regarding entities other than parameter packs, the parameter pack is considered to be the entity that would result from an instantiation of the pattern in which it appears.
[Example:
...
Change 13.7.4 [temp.variadic] paragraph 6 as follows:
...Each Ei is generated by instantiating the pattern and replacing each pack expansion parameter with its ith element. Such an element, in the context of the instantiation, is interpreted as follows:
if the pack is a template parameter pack, the element is a template parameter (13.2 [temp.param]) of the corresponding kind (type or non-type) designating the type or value from the template argument; otherwise,
if the pack is a function parameter pack, the element is an id-expression designating the function parameter that resulted from the instantiation of the pattern where the pack is declared.
All of the Ei become elements in the enclosing list. [Note:...