According to ISO standard you have explicitly qualify the "Base" members: template <typename _type> class AnotherClass : public MyClass<_type> { public: void print( void ) const { // THE ERROR IS ON THIS LINE std::cerr << "m_value = " << MyClass<_type>::m_value << '\n'; } }; gcc 3.4 is mutch more closed to ISO. Read carefully info about gcc 3.4: http://gcc.gnu.org/gcc-3.4/changes.html ---- Lev Assinovsky Aelita Software Corporation (now is a part of Quest Software) O&S InTrust Framework Division, Team Leader ICQ# 165072909 > -----Original Message----- > From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx]On > Behalf Of Laurent Marzullo > Sent: Wednesday, June 09, 2004 2:08 PM > To: gcc-help@xxxxxxxxxxx > Subject: Inherite from template witth gcc 3.4 > > > Hello, > > Could someone explain why this do not compile anymore with GCC 3.4 ? > (and compile with 3.2) > > #include <iostream> > > template <typename _type> > class MyClass > { > public: > _type m_value; > }; > > template <typename _type> > class AnotherClass : public MyClass<_type> > { > public: > void print( void ) const > { > // THE ERROR IS ON THIS LINE > std::cerr << "m_value = " << m_value << '\n'; > } > }; > > int > main( void ) > { > AnotherClass<bool> a; > a.print(); > return 0; > } > > > > template.cpp: In member function `void AnotherClass<_type>::print() > const': > template.cpp:18: error: `m_value' undeclared (first use this function) > template.cpp:18: error: (Each undeclared identifier is reported only > once for each function it appears in.) > > I should specify, explicitly, MyClass<_type>::m_value for the program > to compile. Why should I specify the base class for accessing this > member ? > > Is there any way to go around this 'probleme' with gcc 3.4 ? > Thanks > Laurent Marzullo > > >