I have code:
#include
template class>
struct Foo
{
enum { n = 77 };
};
template
`template class C>
is no more specialized than
template class>
Both of them takes a list of unknown type parameters. it is just that the former takes one member of this list as a different parameter. It contains no additional info about the type such that the compiler should select one over the other.
In the typical usage of variadic templates this specialization is generated in terms of parameter count. Thinking about the variadic templates as recursive functions during runtime, you should just supply the terminating condition (as a class taking only one unknown type).
Clang is very keen on diagnostics so I think it is catching the abnormality and rightfully giving errors.
GCC's being able to compile it is strange. Maybe because you are explicitly specifying which templates to use in struct A
and struct B
seperately, gcc was able to catch that and suppress the abnormality.