public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Bug involving derived template classes in G++ 3.4.3
@ 2004-12-28 20:26 John M Collins
  2004-12-28 20:27 ` Andrew Pinski
  0 siblings, 1 reply; 3+ messages in thread
From: John M Collins @ 2004-12-28 20:26 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug involving derived template classes in G++ 3.4.3
  2004-12-28 20:26 Bug involving derived template classes in G++ 3.4.3 John M Collins
@ 2004-12-28 20:27 ` Andrew Pinski
  2004-12-28 20:55   ` John M Collins
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2004-12-28 20:27 UTC (permalink / raw)
  To: John M Collins; +Cc: gcc-bugs


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug involving derived template classes in G++ 3.4.3
  2004-12-28 20:27 ` Andrew Pinski
@ 2004-12-28 20:55   ` John M Collins
  0 siblings, 0 replies; 3+ messages in thread
From: John M Collins @ 2004-12-28 20:55 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-28 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-28 20:26 Bug involving derived template classes in G++ 3.4.3 John M Collins
2004-12-28 20:27 ` Andrew Pinski
2004-12-28 20:55   ` John M Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).