This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Common V3 coding bug
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