This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bug involving derived template classes in G++ 3.4.3
- From: John M Collins <jmc at xisl dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Dec 2004 20:26:02 +0000
- Subject: Bug involving derived template classes in G++ 3.4.3
- Organization: Xi Software Ltd
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