[Bug c++/93209] What is a bitfield's "underlying type"?
John.Adriaan at BigPond dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 9 10:32:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93209
--- Comment #2 from John Adriaan <John.Adriaan at BigPond dot com> ---
Wow: I just realised. The following code for my proposal is problematic:
struct S {
bool b : 1;
unsigned i : 1;
unsigned : 0;
char c : 8;
}; // S
Should `c` be aligned at one byte (its field) or four bytes (the padding field)
after the beginning of `S`?
According to the current implementation, it's four bytes - so again, the
padding `: 0` operator seems to be the overriding by its own type, not that of
the following field.
Also note that removing the `: 0` field pulls `c` back to a (padded) position
six bits _after_ `i`
More information about the Gcc-bugs
mailing list