------- Comment #1 from joseph at codesourcery dot com 2008-09-17 14:50 ------- Subject: Re: New: bitfield not promoted to int
On Wed, 17 Sep 2008, clemens at ladisch dot de wrote: > In the following program, the type of the assignment expression "f.x = 1" > should be int, according to the integer promotion rules. > However, gcc 4.xx (on all architectures I've tested) prints "1". Why do you think the type should be int instead of int:1? The conclusion from C90 DRs was that bit-fields have their own types, and from C99 DRs was to leave whether they have their own types implementation-defined, and GCC follows the C90 DRs and so the assignment has type int:1 and is not promoted as an operand of sizeof. Now, for C++ you have a valid bug report, since there bit-fields do not have their own types, and the reported behavior appears for C++ as well. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37560