http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59056
--- Comment #8 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> --- (In reply to Walter Mascarenhas from comment #7) > In itself, Richard's paragraph "Morally, the function should ambiguous... " > implies that the code below is ambiguous. However, it > compiles just fine with gcc 4.8.1, because gcc also takes into > account the information that check< Foo<int> >() is false > in order to discard the specialization with the enable_if. In > other words, the X in check<X> is not completely arbitrary, > it my be related to Foo<T>. GCC can't instantiate check<Ty> with a dependent type Ty, because that's not a meaningful thing to do. And it's not allowed to use Foo<int>, because partial ordering of templates does not depend on the actual deduced arguments for the template specialization (it orders the templates themselves, not their specializations). Also, the only available definition of check always returns true. So I really don't see how that could be the case.