This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-06


2053. auto in non-generic lambdas

Section: 9.2.9.7  [dcl.spec.auto]     Status: C++20     Submitter: Faisal Vali     Date: 2014-12-07

[Accepted as a DR at the February, 2020 (Prague) meeting.]

According to 9.2.9.7 [dcl.spec.auto] paragraph 3,

If the auto type-specifier appears as one of the decl-specifiers in the decl-specifier-seq of a parameter-declaration of a lambda-expression, the lambda is a generic lambda (7.5.6 [expr.prim.lambda]).

and 7.5.6 [expr.prim.lambda] paragraph 5 says,

For a generic lambda, the closure type has a public inline function call operator member template (13.7.3 [temp.mem]) whose template-parameter-list consists of one invented type template-parameter for each occurrence of auto in the lambda's parameter-declaration-clause, in order of appearance.

However, an auto that signals a trailing-return-type should be excluded from these descriptions.

Proposed resolution (February, 2020):

This issue is resolved by the resolution of issue 2447.