This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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<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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]