https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59254
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2015-03-23 00:00:00 |2020-7-29 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- If I add a declaration of an explicit specialization A<long> we get another unhelpful error: namespace outer { inline namespace inner { template<typename T> struct A; } template<typename T> struct A; template struct A<int>; template<> struct A<long>; } n.cc:8:19: error: 'A' is not a class template 8 | template struct A<int>; | ^ n.cc:8:19: error: template argument required for 'struct A' n.cc:10:21: error: 'A' is not a class template 10 | template<> struct A<long>; | ^ n.cc:10:21: error: template specifiers not specified in declaration of 'template<class T> struct outer::A' I have no idea what "template specifiers not specified in declaration" means. Clang is more clear about the problem (the class template is declared twice and so causes ambiguities): n.cc:8:19: error: reference to 'A' is ambiguous template struct A<int>; ^ n.cc:6:31: note: candidate found by name lookup is 'outer::A' template<typename T> struct A; ^ n.cc:3:33: note: candidate found by name lookup is 'outer::inner::A' template<typename T> struct A; ^ n.cc:8:19: error: explicit instantiation of undefined template 'outer::A<int>' template struct A<int>; ^ n.cc:6:31: note: template is declared here template<typename T> struct A; ^ n.cc:10:21: error: reference to 'A' is ambiguous template<> struct A<long>; ^ n.cc:6:31: note: candidate found by name lookup is 'outer::A' template<typename T> struct A; ^ n.cc:3:33: note: candidate found by name lookup is 'outer::inner::A' template<typename T> struct A; ^ EDG does well too: "n.cc", line 8: error: "outer::A" is ambiguous template struct A<int>; ^ "n.cc", line 8: error: invalid explicit instantiation declaration template struct A<int>; ^ "n.cc", line 10: error: "outer::A" is ambiguous template<> struct A<long>; ^ 3 errors detected in the compilation of "n.cc".