https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115716
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I suppose the problem is that we do not detect too many template parameters here: template<typename T> struct S { template<typename U> struct N { }; }; template<> template<typename U, typename X> // bad struct S<int>::N { }; while clang++ says: q.C:8:1: error: too many template parameters in template redeclaration 8 | template<typename U, typename X> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ q.C:3:3: note: previous template declaration is here 3 | template<typename U> | ^~~~~~~~~~~~~~~~~~~~