https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86966
--- Comment #2 from Vladimir Reshetnikov <v.reshetnikov at gmail dot com> --- I believe the code is valid. We explicitly specialize the member class template X of S for S<> (i.e. the parameter pack T is empty). T is expanded into a list of zero non-type template parameters of S<>::X. Here is a similar code where we specialize for S<bool>, i.e. provide one template argument bool for the pack T: template<class... T> struct S { template<T...> struct X { }; }; template<> template<bool> struct S<bool>::X { }; Here T is expanded into a list of one non-type template parameter of type bool. This code compiles successfully.