The following enumerated type definitions packs to one byte as expected in C, but not in C++:
typedef enum __attribute__ ((packed)) { ZERO = 0, ONE, TWO } my_enum_t; The enum will pack as expected if using -fshort-enums, but that doesn't allow me to pack on a per-enum basis. Neither will the above enum pack as a packed member in a structure or as a member in a packed structure. Test case to follow. -- Summary: G++ never packs typedef'd enums Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bryce dot schober at gmail dot com GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40751