|
6905 | 6905 | function name, there is no way to provide an explicit template
|
6906 | 6906 | argument list for these function templates.
|
6907 | 6907 | \end{note}
|
6908 |
| -% L7048 USA Core3 1.18 / 14.8.1 [temp.arg.explicit] |
6909 |
| -% WG21 decided not to address this issue except to document that |
6910 |
| -% argument-dependent lookup does not apply in this context. |
6911 |
| - |
6912 |
| -\pnum |
6913 |
| -\begin{note} |
6914 |
| -For simple function names, argument dependent lookup\iref{basic.lookup.argdep} |
6915 |
| -applies even when the function name is not visible within the scope of the call. |
6916 |
| -This is because the call still has the syntactic form of a function call\iref{basic.lookup.unqual}. |
6917 |
| -But when a function template with explicit template arguments is used, |
6918 |
| -the call does not have the correct syntactic form unless there is a function |
6919 |
| -template with that name visible at the point of the call. |
6920 |
| -If no such name is visible, |
6921 |
| -the call is not syntactically well-formed and argument-dependent lookup |
6922 |
| -does not apply. |
6923 |
| -If some such name is visible, |
6924 |
| -argument dependent lookup applies and additional function templates |
6925 |
| -may be found in other namespaces. |
6926 |
| -\begin{example} |
6927 |
| - |
6928 |
| -% Argument added to f per Usenet posting from martin von Loewis, 6 Sep 1998 |
6929 |
| -\begin{codeblock} |
6930 |
| -namespace A { |
6931 |
| - struct B { }; |
6932 |
| - template<int X> void f(B); |
6933 |
| -} |
6934 |
| -namespace C { |
6935 |
| - template<class T> void f(T t); |
6936 |
| -} |
6937 |
| -void g(A::B b) { |
6938 |
| - f<3>(b); // ill-formed: not a function call |
6939 |
| - A::f<3>(b); // well-formed |
6940 |
| - C::f<3>(b); // ill-formed; argument dependent lookup applies only to unqualified names |
6941 |
| - using C::f; |
6942 |
| - f<3>(b); // well-formed because \tcode{C::f} is visible; then \tcode{A::f} is found by argument dependent lookup |
6943 |
| -} |
6944 |
| -\end{codeblock} |
6945 |
| -\end{example} |
6946 |
| -\end{note} |
6947 | 6908 |
|
6948 | 6909 | \pnum
|
6949 | 6910 | Template argument deduction can extend the sequence of template
|
|
0 commit comments