Title
Introducing template-names
Status
open
Section
13.1 [temp.pre]
Submitter
Brian Bi

Created on 2024-06-14.00:00:00 last changed 2 months ago

Messages

Date: 2024-06-26.13:56:15

A template-declaration should, but does not, introduce the identifier in its declarator-id as a template-name. Subclause 13.2 [temp.param] paragraph 3 already does so for template template-parameters.

Possible resolution (based on issue 2862):

  1. Change in 9.2.4 [dcl.typedef] paragraph 2 as follows:

    A typedef-name can also be introduced by an alias-declaration. The identifier following the using keyword is not looked up; if the alias-declaration does not introduce an alias template (13.1 [temp.pre]), the identifier it becomes a typedef-name and the. The optional attribute-specifier-seq following the identifier appertains to that typedef-name or, if the identifier is a template-name, to that template-name. Such a typedef-name has the same semantics as if it were introduced by the typedef specifier. In particular, it does not define a new type.
  2. Change in 11.1 [class.pre] paragraph 1 as follows:

    A class is a type. Its name becomes a class-name (11.3 [class.name]) within its scope.
      class-name :
          identifier
          simple-template-id
    
    ... Otherwise, the class-name is an identifier; it is not looked up, and if the class-specifier does not introduce a class template (13.1 [temp.pre]), the class-specifier introduces it the identifier as a class-name.
  3. Change in 13.1 [temp.pre] paragraph 3 as follows:

    • A class template is introduced by a template-declaration whose declaration is a simple-declaration that either contains a class-specifier in its decl-specifier-seq or consists solely of an elaborated-type-specifier.
    • A function template is introduced by a template-declaration whose declaration declares a function.
    • An alias template is introduced by a template-declaration whose declaration is an alias-declaration.
    • A variable template is introduced by a template-declaration whose declaration declares a variable.
    The declaration of a class template, alias template, or variable template introduces its respective name as a template-name.
  4. Change in 13.7.8 [temp.alias] paragraph 1 as follows:

    A template-declaration in which the declaration is an alias-declaration (9.1 [dcl.pre]) declares the identifier to be an alias template. An alias template is a name for a family of types. The name of the alias template is a template-name.
  5. Change in 13.7.9 [temp.concept] paragraph 2 as follows:

    A concept-definition declares a concept. Its identifier becomes a template-name and a concept-name referring to that concept within its scope. The optional attribute-specifier-seq appertains to the concept.
  6. Change in 13.3 [temp.names] paragraph 3 as follows:

    [ Note: If the name is an identifier, it is then interpreted as a template-name. [ Note: The keyword template is used to indicate that a dependent qualified name (13.8.3.2 [temp.dep.type]) denotes a template where an expression might appear. —end note]
History
Date User Action Args
2024-06-14 00:00:00admincreate