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

2024-04-18


2293. Requirements for simple-template-id used as a class-name

Section: Clause 11  [class]     Status: CD5     Submitter: CWG     Date: 2016-06-22

[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):

  1. Change _N4868_.6.4.1 [basic.scope.declarative] paragraph 1 as follows:

  2. 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 is valid valid, that is, in which that name may be used as an unqualified name to refer to the same entity. In general...
  3. Add the following as a new paragraph after 13.3 [temp.names] paragraph 7:

  4. A template-id that names an alias template specialization is a type-name.

    A template-id is valid if

    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]

  5. Change 13.10.3 [temp.deduct] paragraph 2 as follows, converting from bullets to running text:

  6. 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 below given 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: