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
[Accepted as a DR at the March, 2024 meeting.]
Issue 2542 (approved in June, 2023) made all closure types not be structural types, i.e. unsuitable for use as non-type template parameters. This causes an inconsistency with the treatment of the pointer-to-function conversion for closure types with no captures:
template <auto V> void foo() {} void bar() { foo<[i = 3] { return i; }>(); // #1: error foo<[]{}>(); // #2: error foo<+[]{}>(); // #3: OK, a function pointer is a structural type }
Proposed resolution (approved by CWG 2024-02-02):
Change in 7.5.6.2 [expr.prim.lambda.closure] paragraph 3 as follows:
The closure type is not an aggregate type (9.4.2 [dcl.init.aggr])and not; it is a structural type (13.2 [temp.param]) if and only if the lambda has no lambda-capture. An implementation may define the closure type differently from ...
Change in 13.6 [temp.type] paragraph 2 as follows:
Two values are template-argument-equivalent if they are of the same type and
- ...
- they are of a closure type (7.5.6.2 [expr.prim.lambda.closure]), or
- they are of class type and their corresponding direct subobjects and reference members are template-argument-equivalent.