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

2024-04-18


2261. Explicit instantiation of in-class friend definition

Section: 13.7.5  [temp.friend]     Status: extension     Submitter: Jens Maurer     Date: 2016-04-28

The status of an example like the following is unclear:

  struct S {
   template <class T> friend void f(T) { }
  };
  template void f(int);  // Well-formed?

A friend is not found by ordinary name lookup until it is explicitly declared in the containing namespace, but declaration matching does not use ordinary name lookup. There is implementation divergence on the handling of this example.

Notes from the March, 2018 meeting:

CWG did not come to consensus on the desired outcome and feels that the question should be addressed by EWG.