[dcl.type.splice] (original) (raw)

9 Declarations [dcl]

9.2 Specifiers [dcl.spec]

9.2.9 Type specifiers [dcl.type]

9.2.9.9 Type splicing [dcl.type.splice]

splice-type-specifier:
typename splice-specifier
typename splice-specialization-specifier

1

#

A splice-specifier orsplice-specialization-specifierimmediately followed by ​::​is never interpreted as part of a splice-type-specifier.

A splice-specifier orsplice-specialization-specifiernot preceded by typenameis only interpreted as a splice-type-specifierwithin a type-only context ([temp.res.general]).

[Example 1: template<std::meta::info R> void tfn() { typename [:R:]::type m; // OK, typename applies to the qualified name } struct S { using type = int; };void fn() { [:^^S::type:] *var; // error: [:^^S​::​type:] is an expression typename [:^^S::type:] *var; // OK, declares variable with type int* } using alias = [:^^S::type:]; // OK, type-only context — _end example_]

2

#

For a splice-type-specifier of the formtypename splice-specifier, the splice-specifier shall designate a type, a class template, or an alias template.

The splice-type-specifier designates the same entity as the splice-specifier.

3

#

For a splice-type-specifier of the formtypename splice-specialization-specifier, the splice-specifier of the splice-specialization-specifiershall designate a template Tthat is either a class template or an alias template.

The splice-type-specifier designates the specialization of T corresponding to the template argument list of the splice-specialization-specifier.