S
Simon White
Hi,
I have code that looks legal to me and has compiled for years and on
latest VC, etc compilers. Just recently gcc made a change to their
compiler (3.4) that broke it. I don't have access to the C++ standard
but information we do have access to uptill now suggests that this
shouldn't be a problem. A code example is this:
template<class T>
class Base
{
protected:
T* a;
};
template<class T>
class Child: public Base<T>
{
public:
Child() { a = 0; }
};
When compiled gcc 3.4 now complains that "a" is undefined as it nolonger
looks to the base class(es). By default it now looks only to its own
class scope or global scope. It now means you have to add either "using
Base<T> a" to the child class or change occurances to use this->a.
Is this behaviour correct and just wondered what reasoning there was
behind it, especially when making the behaviour inconsistant after so
long with normal structs and classes, requring large amounts of code rework?
Regards,
Simon
I have code that looks legal to me and has compiled for years and on
latest VC, etc compilers. Just recently gcc made a change to their
compiler (3.4) that broke it. I don't have access to the C++ standard
but information we do have access to uptill now suggests that this
shouldn't be a problem. A code example is this:
template<class T>
class Base
{
protected:
T* a;
};
template<class T>
class Child: public Base<T>
{
public:
Child() { a = 0; }
};
When compiled gcc 3.4 now complains that "a" is undefined as it nolonger
looks to the base class(es). By default it now looks only to its own
class scope or global scope. It now means you have to add either "using
Base<T> a" to the child class or change occurances to use this->a.
Is this behaviour correct and just wondered what reasoning there was
behind it, especially when making the behaviour inconsistant after so
long with normal structs and classes, requring large amounts of code rework?
Regards,
Simon