template derived class cannot access protected variables in template base class
complier: g++ version 4.1.1 error message: main.cpp: In constructor D<T>::D(): main.cpp:13: error: var was not declared in this scope (compiling with g++ version 3.2, everything is OK) Entire test program is listed below---------- #include <iostream> using namespace std; template <class T> class B { protected: T var; }; template <class T> class D : public B<T> { public: D() { var = 1;} }; int main() { D<int> obj; return 0; } -- Summary: template derived class cannot access protected variables in template base class Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: juechangan at yahoo dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28851