Are multiple class template specialisations valid, when each is distinct only between patterns involving template parameters in non-deduced contexts?
A common exampl
There is a rule that partial specializations have to be more specialized than the primary template - both of your specializations follow that rule. But there isn't a rule that states that partial specializations can never be ambiguous. It's more that - if instantiation leads to ambiguous specialization, the program is ill-formed. But that ambiguous instantiation has to happen first!
It appears that clang is suffering from CWG 1558 here and is overly eager about substituting in . void for std::void_t
This is CWG 1980 almost exactly:
In an example like
templateusing X = T; template X f(); template X f(); it appears that the second declaration of
fis a redeclaration of the first but distinguishable by SFINAE, i.e., equivalent but not functionally equivalent.
If you use the non-alias implementation of void_t:
template struct make_void { using type = void; };
template using void_t = typename make_void::type;
then clang allows the two different specializations. Sure, instantiating has_members on a type that has both type1 and type2 typedefs errors, but that's expected.