------- Comment #1 from rguenth at gcc dot gnu dot org 2005-11-11 15:06 ------- It looks like we are looking up the name 'foo' from bar in X only (because X::B is a qualified type and so special name-lookup rules apply), but search the scope of bar (or g) only from the context of g. So the following compiles:
namespace X { struct A {}; struct B {}; } void foo(X::A&); template <class T> void g(T& t) { foo(t); } namespace X { void foo(X::B&); } void bar(X::B& b) { g(b); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24795