------- Comment #1 from pinskia at gcc dot gnu dot org 2006-11-15 18:10 ------- I don't think this is a bug. There are two clauses to the C++ standard about namelookup in templates. One applies where the definition. And the other applies to both definition and instaination but only for the namespace containing the type.
Take the first case: class c; template<typename T> class tm { public: const T& g() const; }; namespace n { template <class T> int fn(const tm<T> &v) { return fn(v.g()); // we have one overloading function for fn, the current template fn // at definition } int fn(const c *p); } int main() { tm<c *> v; return n::fn(v); // when instationating this function fn, we look again at the overloading // set for fn but since c is defined in the global namespace, we don't see // the other fn in namespace n. } PR 2922/DR 197 describes this better than I can right now. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29844