http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59705
Bug ID: 59705 Summary: possible compiler bug regarding SFINAE (program compiles fine) Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haynberg at sig dot com The last two lines of output should be the same ("has iterator") but, for some reason, GCC requires the member function to be qualified for the non-variadic version to be selected. Clang does not need this and it has the same output for the last two lines. G++ version: 4.81 (also tried older versions) System: SUSE SLES11 Enterprise SP1 Intel x86-64 $ cat t.cpp #include <iostream> using namespace std; struct HasIter { typedef int * const_iterator; }; struct NoIter { }; template <typename T> void foo(const T &, typename T::const_iterator *) { cout << "has iterator" << endl; } template <typename T> void foo(const T &, ...) { cout << "no iterator" << endl; } int main() { HasIter has_iter; NoIter no_iter; foo(no_iter, 0); foo(has_iter, 0); foo<HasIter>(has_iter, 0); } $ g++ t.cpp && a.out no iterator no iterator has iterator $ clang-3.3/bin/clang++ t.cpp && a.out no iterator has iterator has iterator Jay Haynberg