The following code (simplified for clarity), does not compile on GCC versions past 4.0, but compiles fine with gcc-3.3 and other non-GCC compilers (MSVC++, etc):
#include <stdio.h> template<int elem_size> class VectorBase { protected: char * memory; public: VectorBase() { memory = NULL; } }; template<typename T> struct Vector : public VectorBase<sizeof(T)> { T * ptr() { return (T*)memory; } }; int main() { return 0; } -- Summary: Template Inheritance Regression from 3.3 (accessing protected member from sublcass) Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: myrd at projectmagma dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31623