g++ and templates

Mihai Donțu mihai.dontu@gmail.com
Thu Feb 21 13:53:00 GMT 2008


Hi,

Can anyone tell me why the following code won't compile with g++ (4.1.2) ?

class U
{
        protected :
                int h;
};

template<typename T> class A: public U
{
};

template<typename T> class B: public A<T>
{
        public :
                void foo(int t)
                {
                        h = t;
                }
};

int main()
{
        return 0;
}

It is, however, "digested" well by g++ 3.2.2 and g++ 3.3.4

Thank you.

-- 
Mihai Donțu



More information about the Gcc-help mailing list