This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/29844] Lookup of template dependent function fails in namespace



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]