This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30277] bit-field: wrong overload resolution
- From: "s__nakayama at infoseek dot jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jan 2007 18:28:39 -0000
- Subject: [Bug c++/30277] bit-field: wrong overload resolution
- References: <bug-30277-10812@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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