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 June, 2018 (Rapperswil) meeting.]
There is currently no requirement that a simple-template-id used as a class-name (Clause 11 [class] paragraph 1) must have template arguments for every template parameter that does not have a default template argument.
Proposed resolution (March, 2018):
Change _N4868_.6.4.1 [basic.scope.declarative] paragraph 1 as follows:
Every name is introduced in some portion of program text called a declarative region, which is the largest part of the program in which that name isvalidvalid, that is, in which that name may be used as an unqualified name to refer to the same entity. In general...
Add the following as a new paragraph after 13.3 [temp.names] paragraph 7:
A template-id that names an alias template specialization is a type-name.
A template-id is valid if
there are at most as many arguments as there are parameters or a parameter is a template parameter pack (13.7.4 [temp.variadic]),
there is an argument for each non-deducible non-pack parameter that does not have a default template-argument,
each template-argument matches the corresponding template-parameter (13.4 [temp.arg]),
substitution of each template argument into the following template parameters (if any) succeeds, and
if the template-id is non-dependent, the associated constraints are satisfied as specified in the next paragraph.
A simple-template-id shall be valid unless it names a function template specialization (13.10.3 [temp.deduct]). [Example:
template<class T, T::type n = 0> class X; struct S { using type = int; }; using T1 = X<S, int, int>; // error: too many arguments using T2 = X<>; // error: no default argument for first template parameter using T3 = X<1>; // error: value 1 does not match type-parameter using T4 = X<int>; // error: substitution failure for second template parameter using T5 = X<S>; // OK—end example]
Change 13.10.3 [temp.deduct] paragraph 2 as follows, converting from bullets to running text:
When an explicit template argument list is specified, if the
template arguments are not compatible with the template parameter list or do not result in a valid function type as described belowgiven template-id is invalid (13.3 [temp.names]), type deduction fails.Specifically, the following steps are performed when evaluating an explicitly specified template argument list with respect to a given function template:
If the specified template arguments do not match the template parameters in kind (i.e., type, non-type, template), or if there are more arguments than there are parameters and no parameter is a template parameter pack, or if there is not an argument for each non-pack parameter, type deduction fails.
If any non-type argument does not match the type of the corresponding non-type template parameter, and is not convertible to the type of the corresponding non-type parameter as specified in 13.4.3 [temp.arg.nontype], type deduction fails.The specified template argument values are substituted for the corresponding template parameters as specified below.