[Bug c++/30277] bit-field: wrong overload resolution
s__nakayama at infoseek dot jp
gcc-bugzilla@gcc.gnu.org
Mon Jan 22 18:28:00 GMT 2007
------- Comment #3 from s__nakayama at infoseek dot jp 2007-01-22 18:28 -------
(In reply to comment #1)
> I only have the C99 standard, and there I read in 6.3.1.1 p2 that only
> those variables are promoted to int that are of smaller size.
>
> Similarly, in 6.3.1.8, integer promotion rules are specified, and they
> specify that types in binary operations are always converted to the type
> with the greater range. In your case, this would be signed long. Do
> you disagree with this rationale?
C++03 4.5 p3
| An rvalue for an integral bit-field (9.6) can be converted
| to an rvalue of type int if int can represent all the values
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| of the bit-field; otherwise, it can be converted to unsigned
^^^^^^^^^^^^^^^^
| int if unsigned int can represent all the values of the
| bit-field. If the bit-field is larger yet, no integral promotion
| applies to it. If the bit-field has an enumerated type, it is
| treated as any other value of that type for promotion purposes.
32bit bit-fields and int has the same range of value.
The bit-field shall be converted to int, because int can
represent all the values of 32bit bit-fields.
--
s__nakayama at infoseek dot jp changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |UNCONFIRMED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30277
More information about the Gcc-bugs
mailing list