This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
[Voted into WP at October 2004 meeting.]
13.7.5 [temp.friend] paragraph 2 was overlooked when the changes for issue 166 were made.
The friend declaration of f<>(int) is now valid.
A friend function declaration that is not a template declaration and in which the name of the friend is an unqualified template-id shall refer to a specialization of a function template declared in the nearest enclosing namespace scope. [Example:namespace N { template <class T> void f(T); void g(int); namespace M { template <class T> void h(T); template <class T> void i(T); struct A { friend void f<>(int); // ill-formed - N::f friend void h<>(int); // OK - M::h friend void g(int); // OK - new decl of M::g template <class T> void i(T); friend void i<>(int); // ill-formed - A::i }; } }--end example]
Proposed Resolution (October 2003):
Remove 13.7.5 [temp.friend] paragraph 2:
A friend function declaration that is not a template declaration and in which the name of the friend is an unqualified template-id shall refer to a specialization of a function template declared in the nearest enclosing namespace scope. [Example:namespace N { template <class T> void f(T); void g(int); namespace M { template <class T> void h(T); template <class T> void i(T); struct A { friend void f<>(int); // ill-formed - N::f friend void h<>(int); // OK - M::h friend void g(int); // OK - new decl of M::g template <class T> void i(T); friend void i<>(int); // ill-formed - A::i }; } }--end example]