Gcc 4.0 (and prior) rejects the well-fromed program below. The error message suggests that the compiler attempts to call the function A<int>::foo() defined in the dependent base class of B<int> contrary to the requirement in 14.6.2, p3, but fails to consider the function foo(A<int>).
$ cat t.cpp && g++ t.cpp /* 1 */ template <class T> struct A { int foo (T) { return 1; } }; /* 2 */ template <class T> int foo (T) { return 2; } /* 3 */ template <class T> struct B: T { int bar () { return foo (T ()); } }; /* 4 */ int foo (A<int>) { return 0; } /* 5 */ int main () { return B<A<int> >().bar (); } t.cpp: In member function 'int B<T>::bar() [with T = A<int>]': t.cpp:5: instantiated from here t.cpp:3: error: no matching function for call to 'B<A<int> >::foo(A<int>)' t.cpp:1: note: candidates are: int A<T>::foo(T) [with T = int] -- Summary: gcc 4.0 examines dependent base classes Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sebor at roguewave dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22040