g++.dg/ext/packed3.C

Nathan Sidwell nathan@codesourcery.com
Wed Dec 7 16:21:00 GMT 2005


Jan Beulich wrote:

> And that is precisely the reason why I think binding a reference to the
> whole object or any of its members, when the object itself is a member
> of a packed object, is illegal, hence requiring a diagnostic (unless,
> like for both other cases, the default is to pack structures).

Doing that will break
	struct Foo { void operator=(Foo const &);};
	struct Baz __attribute__((packed))
	{
	  char c;
	  Foo m;
	}

	void Bar (Baz *ptr)
	{
	  ptr->m = something;
	}
This is something we need to make work.


>>If your system packs structs by default, you should not be getting the
> 
> warning 
> 
>>on any of the uses.
> 
> 
> But I do, and if I use a native Linux compiler with -fpack-struct, I
> also get it (along with a second one on one of the two other
> instances).

Then I think you have a bug.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



More information about the Gcc mailing list