https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71825
--- Comment #1 from Zhendong Su <su at cs dot ucdavis.edu> --- Both the following are accepted: $ g++-trunk -c small1.cpp $ cat small1.cpp namespace N { template < class > struct A; } template < class T > struct N::A { A () {} }; $ $ g++-trunk -c small2.cpp $ cat small2.cpp namespace N { template < class > struct A; } template < class A > struct N::A { };