|
715 | 715 |
|
716 | 716 | \begin{bnf} |
717 | 717 | \nontermdef{template-argument}\br |
| 718 | + template-argument-name\br |
718 | 719 | constant-expression\br |
719 | | - type-id\br |
720 | | - \opt{nested-name-specifier} template-name\br |
721 | | - nested-name-specifier \terminal{template} template-name |
| 720 | + type-id |
| 721 | +\end{bnf} |
| 722 | + |
| 723 | +\begin{bnf} |
| 724 | +\nontermdef{template-argument-name}\br |
| 725 | + \opt{nested-name-specifier} identifier\br |
| 726 | + nested-name-specifier \terminal{template} identifier |
722 | 727 | \end{bnf} |
723 | 728 |
|
724 | 729 | \pnum |
|
888 | 893 | \end{codeblock} |
889 | 894 | \end{example} |
890 | 895 |
|
| 896 | +\pnum |
| 897 | +The component names of a \grammarterm{template-argument-name} are |
| 898 | +those of its \grammarterm{nested-name-specifier} (if any) and |
| 899 | +its \grammarterm{identifier}. |
| 900 | + |
891 | 901 | \pnum |
892 | 902 | A \grammarterm{template-id} or \grammarterm{splice-specialization-specifier} |
893 | 903 | is \defnx{valid}{\idxgram{template-id}!valid} if |
|
1051 | 1061 | the $n^\text{th}$ template argument is a pack expansion |
1052 | 1062 | whose pattern is the name of the template parameter pack. |
1053 | 1063 |
|
| 1064 | +\pnum |
| 1065 | +If a \grammarterm{template-argument} $A$ |
| 1066 | +matches the form \grammarterm{template-argument-name}, |
| 1067 | +it is interpreted as such; |
| 1068 | +the identifier is looked up and its meaning is determined as follows: |
| 1069 | +\begin{itemize} |
| 1070 | +\item |
| 1071 | +If lookup finds an injected-class-name\iref{temp.local}, then: |
| 1072 | +\begin{itemize} |
| 1073 | +\item When $A$ is for a type template template parameter, |
| 1074 | +$A$ denotes the corresponding class template. |
| 1075 | +\item Otherwise, it denotes a \grammarterm{type-name}. |
| 1076 | +\end{itemize} |
| 1077 | +\item |
| 1078 | +Otherwise, if lookup finds a template, |
| 1079 | +$A$ denotes that template. |
| 1080 | +\item |
| 1081 | +Otherwise, if lookup finds a type alias or a type, |
| 1082 | +$A$ denotes the underlying type and is interpreted as a \grammarterm{type-id}. |
| 1083 | +\item |
| 1084 | +Otherwise, $A$ is interpreted as an expression. |
| 1085 | +\end{itemize} |
| 1086 | + |
1054 | 1087 | \pnum |
1055 | 1088 | In a |
1056 | 1089 | \grammarterm{template-argument}, |
|
0 commit comments