http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59254
Bug ID: 59254 Summary: confusing diagnostic for undefined template shadowed by declaration in inline namespace Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org namespace outer { inline namespace inner { #ifndef OK template<typename T> struct A; #endif } template<typename T> struct A; template class A<int>; } This gives a confusing diagnostic: $ g++ -std=gnu++11 n.cc -c n.cc:10:18: error: ‘A’ is not a class template template class A<int>; ^ n.cc:10:18: error: template argument required for ‘class A’ That's particularly confusing because A is a class template, and so is inner::A (although if it's just a class type the error is the same) and because a template argument is given. Without the previous definition in the inline namespace we get the expected explanation: $ g++ -std=gnu++11 n.cc -c -DOK n.cc:10:18: error: explicit instantiation of ‘class outer::A<int>’ before definition of template template class A<int>; ^