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 and X:
X matches the first but not the second.X 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.