|
550 | 550 |
|
551 | 551 | \begin{bnf}
|
552 | 552 | \nontermdef{typedef-name}\br
|
553 |
| - identifier |
| 553 | + identifier\br |
| 554 | + simple-template-id |
554 | 555 | \end{bnf}
|
555 | 556 |
|
556 | 557 | A name declared with the \tcode{typedef} specifier becomes a
|
557 |
| -\grammarterm{typedef-name}. Within the scope of its declaration, a |
558 |
| -\grammarterm{typedef-name} is syntactically equivalent to a keyword and |
559 |
| -names the type associated with the identifier in the way described in |
560 |
| -\ref{dcl.decl}. |
| 558 | +\grammarterm{typedef-name}. |
| 559 | +A \grammarterm{typedef-name} names |
| 560 | +the type associated with the \grammarterm{identifier}\iref{dcl.decl} |
| 561 | +or \grammarterm{simple-template-id}\iref{temp}; |
561 | 562 | \indextext{declaration!typedef@\tcode{typedef} as type}%
|
562 | 563 | \indextext{equivalence!type}%
|
563 | 564 | \indextext{synonym!type name as}%
|
564 |
| -A \grammarterm{typedef-name} is thus a synonym for another type. A |
| 565 | +a \grammarterm{typedef-name} is thus a synonym for another type. A |
565 | 566 | \grammarterm{typedef-name} does not introduce a new type the way a class
|
566 |
| -declaration\iref{class.name} or enum declaration does. |
| 567 | +declaration\iref{class.name} or enum declaration\iref{dcl.enum} does. |
567 | 568 | \begin{example}
|
568 | 569 | After
|
569 | 570 |
|
|
677 | 678 | \end{example}
|
678 | 679 |
|
679 | 680 | \pnum
|
680 |
| -\begin{note} |
681 | 681 | \indextext{class name!\idxcode{typedef}}%
|
682 |
| -A \grammarterm{typedef-name} that names a class type, or a cv-qualified |
683 |
| -version thereof, is also a \grammarterm{class-name}\iref{class.name}. If |
684 |
| -a \grammarterm{typedef-name} is used to identify the subject of an |
| 682 | +A \grammarterm{simple-template-id} is only a \grammarterm{typedef-name} |
| 683 | +if its \grammarterm{template-name} names |
| 684 | +an alias template or a template \grammarterm{template-parameter}. |
| 685 | +\begin{note} |
| 686 | +A \grammarterm{simple-template-id} that names a class template specialization |
| 687 | +is a \grammarterm{class-name}\iref{class.name}. |
| 688 | +If a \grammarterm{typedef-name} is used to identify the subject of an |
685 | 689 | \grammarterm{elaborated-type-specifier}\iref{dcl.type.elab}, a class
|
686 | 690 | definition\iref{class}, a constructor
|
687 | 691 | declaration\iref{class.ctor}, or a destructor
|
688 | 692 | declaration\iref{class.dtor}, the program is ill-formed.
|
689 | 693 | \end{note}
|
690 | 694 | \begin{example}
|
691 |
| - |
692 | 695 | \begin{codeblock}
|
693 | 696 | struct S {
|
694 | 697 | S();
|
|
1270 | 1273 | class-name\br
|
1271 | 1274 | enum-name\br
|
1272 | 1275 | typedef-name\br
|
1273 |
| - simple-template-id |
1274 | 1276 | \end{bnf}
|
1275 | 1277 |
|
1276 | 1278 | \begin{bnf}
|
|
1516 | 1518 | the class whenever it is named.
|
1517 | 1519 |
|
1518 | 1520 | \pnum
|
| 1521 | +\begin{note} |
1519 | 1522 | \ref{basic.lookup.elab} describes how name lookup proceeds for the
|
1520 |
| -\grammarterm{identifier} in an \grammarterm{elaborated-type-specifier}. If the |
1521 |
| -\grammarterm{identifier} resolves to a \grammarterm{class-name} or |
| 1523 | +\grammarterm{identifier} in an \grammarterm{elaborated-type-specifier}. |
| 1524 | +\end{note} |
| 1525 | +If the \grammarterm{identifier} or \grammarterm{simple-template-id} |
| 1526 | +resolves to a \grammarterm{class-name} or |
1522 | 1527 | \grammarterm{enum-name}, the \grammarterm{elaborated-type-specifier}
|
1523 | 1528 | introduces it into the declaration the same way a
|
1524 |
| -\grammarterm{simple-type-specifier} introduces its \grammarterm{type-name}. If |
1525 |
| -the \grammarterm{identifier} resolves to a |
1526 |
| -\grammarterm{typedef-name} or the \grammarterm{simple-template-id} resolves to |
1527 |
| -an alias template specialization, |
1528 |
| -the |
1529 |
| -\grammarterm{elaborated-type-specifier} is ill-formed. |
| 1529 | +\grammarterm{simple-type-specifier} introduces |
| 1530 | +its \grammarterm{type-name}\iref{dcl.type.simple}. |
| 1531 | +If the \grammarterm{identifier} or \grammarterm{simple-template-id} resolves to a |
| 1532 | +\grammarterm{typedef-name} (\ref{dcl.typename} \ref{temp.names}), |
| 1533 | +the \grammarterm{elaborated-type-specifier} is ill-formed. |
1530 | 1534 | \begin{note}
|
1531 | 1535 | This implies that, within a class template with a template
|
1532 | 1536 | \grammarterm{type-parameter} \tcode{T}, the declaration
|
|
0 commit comments