This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37560] bitfield not promoted to int
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Sep 2008 14:50:41 -0000
- Subject: [Bug c/37560] bitfield not promoted to int
- References: <bug-37560-8329@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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