Consider the following example: =================================================== template<typename T> struct B { void f(int i) { } void f2() { } }; template<typename T> struct D : public B<T> { int foo(int i) { return i; } void g() { // f(42); // (1) f(foo(42)); // (2) // f2(); // (3) } }; struct E : public D<int> { void h() { g(); } }; ===================================================== This compiles fine with g++ 4.5.2. If one of the lines (1) or (2) is uncommented, the compilation fails with: dependent2.cpp:11: error: there are no arguments to ‘f’ that depend on a template parameter, so a declaration of ‘f’ must be available dependent2.cpp:13: error: there are no arguments to ‘f2’ that depend on a template parameter, so a declaration of ‘f2’ must be available I think the compilation of the call 'f(foo(42))' should fail for the same reason. Regards, Volker
confirmed, not a regression I don't think this is a dup of any existing bugs relating to lookup in dependent bases
I am no C++ Language Lawyer but my understanding is that G++ considers foo in f(foo(42)) as being type dependent. This looks somewhat related to C++ Core Working Group issue http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#1005 and I heard that this issue is being presently discussed. PR c++/47172 is also (remotely) related to this.
Fixed for 4.7. *** This bug has been marked as a duplicate of bug 24163 ***