[Bug c++/40751] G++ never packs typedef'd enums

bryce dot schober at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jul 14 22:31:00 GMT 2009



------- Comment #2 from bryce dot schober at gmail dot com  2009-07-14 22:31 -------
I now see that the following syntax packs as expected:
typedef enum {
        ZERO = 0,
        ONE,
        TWO
} __attribute__ ((packed)) my_enum_t;

I have been unable to find a concise definition of how attributes are supposed
to be used with types in either the Type-Attributes or Attribute-Syntax
sections of the GCC manual. I guess this location for the attribute is a bit
more logical in the sense that the type isn't "complete" until the closing
brace.

It remains unclear whether both attribute locations are supposed to be
supported in both C and C++ or not. Either way, it's certainly not clear from
the docs.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40751



More information about the Gcc-bugs mailing list