[cxx-abi-dev] C++0x POD

Jason Merrill jason at redhat.com
Wed Jul 15 21:47:31 UTC 2009


On 07/15/2009 06:32 PM, Mark Mitchell wrote:
> The ABI already has a definition of "POD for purpose of layout"

The ABI says "However, a POD-struct or POD-union (in the sense of ISO 
C++ [class]) with a bitfield member whose declared width is wider than 
the declared type of the bitfield is not a POD for the purpose of layout."

I didn't remember there being anything in G++ to implement that 
exception, so I checked, and indeed we don't:  For

struct A
{
   int d;
   char c: 16;
};

struct B: A
{
   char c2;
};

We currently allocate 12 bytes for B, whereas it ought to be 8 if we put 
c2 into the tail padding for A, as I would expect if we're saying A 
isn't a POD for the purpose of layout.

I thought this was just a bug, but I see that EDG also allocates 12 bytes.

Do any current compilers make sizeof(B)==8?  Should we just remove that 
sentence (and the one after)?

Jason



More information about the cxx-abi-dev mailing list