Inherite from template witth gcc 3.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux