Bug involving derived template classes in G++ 3.4.3
John M Collins
jmc@xisl.com
Tue Dec 28 20:26:00 GMT 2004
Please "CC" me as I'm not subscribed.
I have the following program segment (cutting down to bare minimum). This has
worked previously with G++ 3.3.* and earlier.
Classes cut down to bare minimum obviously - the "real" ones made use of "X".
class A {
public:
int field1;
};
template<typename X> class B : public A {
public:
int field2;
};
template<typename X> class C : public B<X> {
public:
C(int k) { field1 = k; }
// G++ 3.4.3 complains that "field1" is not defined
void setk(int k) { field1 = k; }
// Likewise it complains.
};
main()
{
C<int> p(17);
return 0;
}
The problem goes away if I put "this->field1" in there instead of bare
"field1" thus
C(int k) { this->field1 = k; }
void setk(int k) { this->field1 = k; }
--
John Collins Xi Software Ltd www.xisl.com
More information about the Gcc-bugs
mailing list