gcc

Comment 1 for bug 915018

Revision history for this message
In , Jwakely-gcc (jwakely-gcc) wrote :

(I first posted this code to PR5660 but it's apparently a separate issue)

   template <typename T>
     struct A
     {
         typedef T Type;
         void f(Type) {}
     };

   template <typename T>
     struct B : A<T>
     {
         typedef typename A<T>::Type Type;
         void ff(Type t) { f(t); } // XXX
     };

   template struct B<int>;

This should fail to compile, according to 14.6.2/3, but 3.4 - 4.1 (and probably
earlier) accept it.

If A::f and the call to it are changed to take no arguments (so that f is not a
dependent name) then it fails, so it is apparently only at instantiation that
the base class scope is examined.