This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-10-11
During the discussion of issue 1918, it was decided that the last part of the issue should be split off into a separate issue. According to 13.7.5 [temp.friend] paragraph 5,
A member of a class template may be declared to be a friend of a non-template class.
Does this make the example from issue 1918,
template<typename T> struct A {
class B {
class C {};
};
};
class X {
static int x;
template <typename T> friend class A<T>::B::C;
};
template<> struct A<int> {
typedef struct Q B;
};
struct Q {
class C {
int f() { return X::x; }
};
};
ill-formed because the friend declaration does not refer to a member of a class template? This does not appear to be the interpretation chosen by most implementations.
Additional note (January, 2024)
The example is ill-formed per the resolution of issue 1862 (adopted in November, 2017).