https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98572

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note other compilers, e.g. clang, behave exactly the same and C++ behaves the
same here.
See e.g. C99 6.3.1.1
"The following may be used in an expression wherever an int or unsigned int may
be used:
— An object or expression with an integer type whose integer conversion rank is
less
than the rank of int and unsigned int.
— A bit-field of type _Bool, int, signed int, or unsigned int.
If an int can represent all values of the original type, the value is converted
to an int;
otherwise, it is converted to an unsigned int. These are called the integer
promotions. 48) All other types are unchanged by the integer promotions."

and as int can represent all values of unsigned int : 24, it is promoted to
int, not unsigned.

Reply via email to