Class template specialization partial ordering and function synthesis
The rules for picking which class template specialization is preferred involve rewriting the specializations into function templates and determining which function template is more specialized via the ordering rules for function templates [temp.class.order]. Consider this example, then: #include <iostream> template <class T> struct voider { using type = void; }; template <class T> using void_t = typename voider<T>::type; template <class T, class U> struct A { }; template <class T> int foo(A<T, void_t<T>> ) { return 1; } template <class T> int foo(A<T*, void> ) { return 2; } int main() { std: