https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69903
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> --- Smaller test case: struct A { template <int i> static void f() { }; }; struct B : A { }; template<> void B::f<0>() { }; int main() { B::f<0> (); } If f is made non-static then the compiler rejects the specialization and there's no ICE. And if "void B::f<0>" is replaced with "void A::f<0>" then the code is accepted without errors.