Title
friend named by a template-id
Status
open
Section
9.3.4.1 [dcl.meaning.general]
Submitter
Davis Herring

Created on 2022-11-18.00:00:00 last changed 24 months ago

Messages

Date: 2022-11-18.00:00:00

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>();
  };
History
Date User Action Args
2022-11-18 00:00:00admincreate