C PATCH for c/52085 (enum forward declarations and attribute packed)

Jeff Law law@redhat.com
Fri Apr 24 18:43:00 GMT 2015


On 04/24/2015 05:36 AM, Marek Polacek wrote:
> On Thu, Apr 23, 2015 at 08:25:51PM -0600, Jeff Law wrote:
>> What happens if we have used the enum inside an aggregate?  Can we just
>> blindly change the alignment/precision like that?
>
> If you just forward declare an enum/struct, it has an incomplete type, so you
> cannot use it inside an aggregate.  In fact, you can't do much with that until
> it's completed, except creating a pointer to it.  E.g. applying sizeof to an
> incomplete type is forbidden.  With my patch, we behave the same as clang.
Clearly a "duh" moment for me.

OK for the trunk.

jeff



More information about the Gcc-patches mailing list