This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112c. See for the official list.


2671. friend named by a template-id

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

Subclause [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>();