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

2024-09-25


2671. friend named by a template-id

Section: 9.3.4.1  [dcl.meaning.general]     Status: open     Submitter: Davis Herring     Date: 2022-11-18

Subclause 9.3.4.1 [dcl.meaning.general] paragraph 1 specifies:

... If the unqualified-id occurring in a declarator-id is a template-id, the declarator shall appear in the declaration of a template-declaration (13.7 [temp.decls]), explicit-specialization (13.9.4 [temp.expl.spec]), or explicit-instantiation (13.9.3 [temp.explicit]).

However, that is too restrictive and prevents befriending template specializations, for example:

  template<typename> void f();

  class A {
    friend void f<A>();
  };