[Example 1: template<int V>struct TCls {staticconstexprint s = V;
using type =int;
};
int v1 =[:^^TCls<1>:]::s;
int v2 =template[:^^TCls:]<2>::s; // OK, template binds to splice-scope-specifiertypename[:^^TCls:]<3>::type v3 =3; // OK, typename binds to the qualified nametemplate[:^^TCls:]<3>::type v4 =4; // OK, template binds to the splice-scope-specifiertypenametemplate[:^^TCls:]<3>::type v5 =5; // OK, same as v3[:^^TCls:]<3>::type v6 =6; // error: unexpected < — end example]
A declaration that uses a declarative nested-name-specifier
shall be a friend declaration or
inhabit a scope that contains the entity being redeclared or specialized.
Letting S be the specialization of T
corresponding to the template argument list of
the splice-specialization-specifier,
S shall either be a class template specialization or
an alias template specialization that denotes a class or enumeration type.
If a nested-name-specifierN
is declarative and
has a simple-template-id with a template argument list A
that involves a template parameter,
let T be the template nominated by N without A.
Otherwise, N designates the partial specialization ([temp.spec.partial]) of T
whose template argument list is equivalent to A ([temp.over.link]);
the program is ill-formed if no such partial specialization exists.