|
694 | 694 | id-expression
|
695 | 695 | \end{bnf}
|
696 | 696 |
|
697 |
| -\begin{note} |
698 |
| -The name lookup rules\iref{basic.lookup} are used to associate the use of |
699 |
| -a name with a template declaration; |
700 |
| -that is, to identify a name as a |
701 |
| -\grammarterm{template-name}. |
702 |
| -\end{note} |
703 |
| - |
704 | 697 | \pnum
|
705 |
| -For a |
706 |
| -\grammarterm{template-name} |
707 |
| -to be explicitly qualified by the template arguments, |
708 |
| -the name must be considered to refer to a template. |
| 698 | +An \grammarterm{identifier} is a \grammarterm{template-name} |
| 699 | +if it is associated by name lookup with |
| 700 | +a template or an overload set that contains a function template, or |
| 701 | +the \grammarterm{identifier} is followed by \tcode{<}, |
| 702 | +the \grammarterm{template-id} would form an \grammarterm{unqualified-id}, and |
| 703 | +name lookup either finds one or more functions or finds nothing. |
709 | 704 | \begin{note}
|
710 | 705 | Whether a name actually refers to a template
|
711 | 706 | cannot be known in some cases
|
712 | 707 | until after argument dependent lookup is done\iref{basic.lookup.argdep}.
|
713 | 708 | \end{note}
|
714 |
| -A name is considered to refer to a template if |
715 |
| -name lookup finds |
716 |
| -a \grammarterm{template-name} |
717 |
| -or an overload set that contains a function template. |
718 |
| -A name is also considered to refer to a template if |
719 |
| -it is an \grammarterm{unqualified-id} |
720 |
| -followed by a \tcode{<} |
721 |
| -and name lookup either finds one or more functions or finds nothing. |
722 | 709 |
|
723 | 710 | \pnum
|
724 | 711 | \indextext{\idxcode{<}!template and}%
|
|
4642 | 4629 | is the standard output stream declared in
|
4643 | 4630 | \tcode{iostream}.
|
4644 | 4631 | However, not every declaration can be found this way; the resolution of
|
4645 |
| -some names must be postponed |
| 4632 | +some names is postponed |
4646 | 4633 | until the actual
|
4647 | 4634 | \grammarterm{template-argument}{s}
|
4648 | 4635 | are known.
|
|
7132 | 7119 | otherwise, it is a declaration.
|
7133 | 7120 | \begin{note}
|
7134 | 7121 | The definition of a static data member of a template
|
7135 |
| -that requires default-initialization must use a \grammarterm{braced-init-list}: |
| 7122 | +for which default-initialization is desired |
| 7123 | +can use functional cast notation\iref{expr.type.conv}: |
7136 | 7124 |
|
7137 | 7125 | \begin{codeblock}
|
7138 | 7126 | template<> X Q<int>::x; // declaration
|
7139 | 7127 | template<> X Q<int>::x (); // error: declares a function
|
7140 |
| -template<> X Q<int>::x { }; // definition |
| 7128 | +template<> X Q<int>::x = X(); // definition |
7141 | 7129 | \end{codeblock}
|
7142 | 7130 | \end{note}
|
7143 | 7131 |
|
|
0 commit comments