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]

Re: g++-2.95.1 mess with nested templates and inheritance


Re http://egcs.cygnus.com/ml/gcc-bugs/1999-10/msg00337.html

It seems to be a name lookup problem, for template functions members of
nested classes.  (Inheritance does not enter into it, and the templates
are not nested.)

You can see this more clearly from the following simplified version of
your test, where adding namespace-scope qualifiers (X::Y::) to the
member function template name takes allows GCC to succeed, while
otherwise, GCC misses it and intprets y_.g as member data.


// Build don't link:
enum Key { A, B };

struct X {
  struct Y {
    template <Key K> inline void g(int);
  };
  template <Key K> inline void f(int);
  Y y_;
};

template <Key K>
inline void X::f(int value) {
  y_.X::Y::g<K>(value); // ok
  y_.g<K>(value); // gets bogus error - no match for lessthan - XFAIL
*-*-*
}

template <Key K>
inline void X::Y::g(int value) {
}

int main() {
  X x;
  x.f<A>(5);
}


-- 
----------------------------------------------------------------------
Paul Burchard   <burchard@pobox.com>   http://www.pobox.com/~burchard/
----------------------------------------------------------------------


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