http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22596
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-22 17:35:09 UTC --- This is not a bug; under the partial ordering rules, the second foo is more specialized than the first, so if both are possible matches the second will be chosen. If you want the explicit instantiation to match the same function that's called with no explicit template arguments, then don't provide explicit template arguments in the explicit instantiation. If you just write template int foo(A_class<int> a); or template int foo<>(A_class<int> a); it will do what you want.