The appended snippet of code should be able to resolve the member variable "foo" in both the Foo1 and Foo2 member functions, but it can't ("error: foo was not declared in this scope"). The "this->" prefix appears to be required to workaround this problem. The code compiles fine with gcc 3.2.3.
template <class X> class Base { public: int foo; }; template <class X> class Subclass : public Base<X> { public: int Foo1() { return this->foo; } int Foo2() { return foo; } }; -- Summary: member variable lookup fails in subclass of templated base class Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: metcalf at lcs dot mit dot edu GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25783