Created on 2019-10-15.00:00:00 last changed 47 months ago
Proposed resolution (February, 2020):
Change 9.2.9.7 [dcl.spec.auto] paragraph 2 as follows:
A placeholder-type-specifier of the form type-constraintopt auto can be usedinas a decl-specifier of the decl-specifier-seq of a parameter-declaration of a function declaration or lambda-expression and, if it is not the auto type-specifier introducing a trailing-return-type (see below), is a generic parameter type placeholder of the function declaration or lambda-expression. [Note: Having a generic parameter type placeholder signifies that the function is an abbreviated function template (9.3.4.6 [dcl.fct]) or the lambda is a generic lambda (7.5.6 [expr.prim.lambda]). —end note]
Change 9.3.4.6 [dcl.fct] paragraph 18 as follows:
An abbreviated function template is a function declarationwhose parameter-type-list includesthat has one or more generic parameter type placeholders (9.2.9.7 [dcl.spec.auto]). An abbreviated function template is equivalent to a function template (13.7.7.2 [temp.over.link]) whose template-parameter-list includes one invented type template-parameter for eachoccurrence of ageneric parameter type placeholdertype in the decl-specifier-seq of a parameter-declaration in the function's parameter-type-listof the function declaration, in order of appearance. For a placeholder-type-specifier of the form...
Change 7.5.6 [expr.prim.lambda] paragraph 5 as follows:
A lambda is a generic lambda ifthere is a decl-specifier that is a placeholder-type-specifier in the decl-specifier-seq of a parameter-declaration ofthe lambda-expression has any generic parameter type placeholders (9.2.9.7 [dcl.spec.auto]), or if the lambda has a template-parameter-list. [Example:...
This resolution also resolves issue 2053.
[Accepted at the February, 2020 (Prague) meeting.]
The current wording for abbreviated function templates could lead to the incorrect conclusion that f and g in the example below are well-formed abbreviated function templates. The g case is the abbreviated function template analog of issue 2053 regarding generic lambdas.
9.2.9.7 [dcl.spec.auto] paragraph 4 clearly disallows the ap case. The inconsistency between the paragraph 2 wording for abbreviated function templates and the paragraph 4 wording is unintentional.
template <typename> struct A; void f(A<auto> x); void g(auto f() -> int); A<auto> *ap = static_cast<A<int> *>(0);
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-12-15 00:00:00 | admin | set | messages: + msg6457 |
2019-10-15 00:00:00 | admin | create |