https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91133
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> --- This is really a question of partial ordering; determining whether the partial specialization is more specialized than the primary class template is equivalent to this testcase: template<typename T> struct Id { typedef T type; }; template<typename T, typename U, U X> struct A {}; template<typename T, typename U, U X> void f(A<T, U, X>); // #1 template<typename T, typename Id<T>::type X> void f(A<T, int, X>); // #2 int main() { f(A<int,int,42>()); // is #2 more specialized? } This was rejected as ambiguous by GCC going back at least to 4.1. It is also rejected by EDG/icc. It is accepted by clang and msvc, like the original testcase. The issue is with the partial ordering deduction of #1 from #2: we deduce int for U from the second argument, and Id<T>::type for U from the third argument, and those don't agree, so deduction for the third argument fails in both directions, and the functions are ambiguous. This is related to open core issues 455 and 1337. I don't know what rationale clang/msvc are using to conclude that #2 is more specialized.