This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-01-15


410. Paragraph missed in changes for issue 166

Section: 13.7.5  [temp.friend]     Status: CD1     Submitter: John Spicer     Date: 18 Apr 2003

[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]