Common V3 coding bug
Mark Mitchell
mark@codesourcery.com
Tue Jul 17 23:20:00 GMT 2001
The new parser is fun because so far I've coded very little in the
way of language extensions. That's partly because I hope to argue
about them before implementing them, and partly because it gives me a way
of shaking out little bugs in V3. :-)
There are a bunch of places in the code where V3 does:
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
hard to catch this with G++, because the current parser doesn't complain
about this case, even with -pedantic.
I'm fixing up the cases I find on the cp-parser-branch.
(Yes, the new parser is doing something similar to two-phase name
lookup, so it gets this mostly right.)
FYI,
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the Libstdc++
mailing list