Hi,
The C++ template code in annex triggers a
compile-time error on 4.2, 4.4, 4.6, but not on 4.7. (I suppose this bug
has been found and tracked before.)
===========================
template<int SIZE> class t1
{
public:
int length;
};
template<int SIZE> class t2 : public t1<SIZE>
{
public:
void f();
};
template<int SIZE>
void t2<SIZE>::f()
{
int &len=(t1<SIZE>::length); // ok
t1<SIZE>::length=100; // ok
unsigned char *val=new unsigned char[t1<SIZE>::length]; // ok
int ln=-(t1<SIZE>::length); // ok
int *ptlen=&(t1<SIZE>::length); // address-of operator in this
// base class template member access
// ==> compiler bug with gcc 4.2 to 4.6
}
void fstatic()
{
t2<1000> obj;
obj.f(); // instantiate ...
}
===========================
In member function 'void t2<SIZE>::f() [with int SIZE = 1000]':
error: cannot convert 'int t1<1000>::*' to 'int*' in initialization
===========================