I cant see why the statement in main is ambiguous.
template struct X
{ void f() { cout << \"Primary template\" << endl
A template specialization is more specialized than another if every argument list that matches the first also matches the second, but not the other way around.
When looking at X<int, T*, 10>
and X<T, T*, I>
:
X<int, float*, 10>
matches the first but not the second.X<float, float*, 10>
matches the second but not the first.Therefore neither is more specialized than the other, and a template instantiation that matches both specializations won't compile.