On 09/01/2011 10:52 AM, Aldy Hernandez wrote:
To answer your question, I believe we can't touch past the last field (into the padding) if the subsequent record will be packed into the first's padding.
Right.
struct A { int a : 17; }; struct B : public A { char c; }; So here, if <c> gets packed into the tail-padding of A, we can't touch the padding of A when storing into <a>.
But that doesn't apply to this testcase because A is a POD class, so we don't mess with its tail padding.
Is there a way of distinguishing this particular variant (possible tail-packing), or will we have to disallow storing into the record tail padding altogether? That would seriously suck.
Basically you can only touch the size of the CLASSTYPE_AS_BASE variant. For many classes this will be the same as the size of the class itself.
Jason