Common V3 coding bug

Gabriel Dos Reis gdr@codesourcery.com
Wed Jul 18 06:29:00 GMT 2001


Levente Farkas <lfarkas@mindmaker.hu> writes:

| >   template <class T> struct A {
| >     int i;
| >   };
| > 
| >   template <class T> struct B : public A<T> {
| >     void f() { i = 3; }
| >   };
| > 
| > This isn't valid C++; there's no `i' in scope in `B'.  You have
| > to add `using A<T>::i;' if you want to do this, or write `B<T>::i'. It's
| 
| why? ok I know it's not a c++ language list but IMHO the above is valid c++
| code, since everything in A are public (A is a struct) and B inherit 
| everything public.

No, that is not OK.  Template base classes are not examinated in the
first phase lookup in template codes.

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com



More information about the Libstdc++ mailing list