https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86747
Nathan Sidwell <nathan at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-07-30 Ever confirmed|0 |1 --- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> --- Let's reduce the anonymousness: template <typename T> class A { template <void (A::*p)()> class C; // #1 template <void (A::*q)()> friend class C; // #2 }; A<double> a; tf.cc: In instantiation of ‘class A<double>’: tf.cc:6:11: required from here tf.cc:2:26: error: template parameter ‘void (A<T>::* p)()’ template <void (A::*p)()> class C; ^ tf.cc:3:42: error: redeclared here as ‘void (A<double>::* q)()’ template <void (A::*q)()> friend class C; It looks like we're not tsubsting the declaration of #1 in A<double>, but are doing so for the friend decl #2.