Bug involving derived template classes in G++ 3.4.3
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 class B : public A { public: int field2; }; template class C : public B { 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 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
Re: Bug involving derived template classes in G++ 3.4.3
On Tuesday 28 Dec 2004 20:27, Andrew Pinski wrote: > On Dec 28, 2004, at 3:26 PM, John M Collins wrote: > > 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. > > Read the 3.4.0 release notes. > > Thanks, > Andrew Pinski Thank you - I apologise for missing that. I wonder if I might suggest that the message be expanded in this case - it did break a good few lines of code - and the way it's broken is not obvious, for example virtual functions in "A" can still be overriden in template class "C" with the expected result. -- John Collins Xi Software Ltd www.xisl.com