[Bug c/107405] enums can be wrongly long in gcc-13 (in gnu99)
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Oct 26 08:21:08 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107405
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jiri Slaby from comment #4)
> Another question is why B is affected by A at all? Also sizeof of that enum
> (if one gives it a name) is 8 with gcc-13. That is not allowed by the
> standard, IMO.
C99, C11, and C17 all say:
"The expression that defines the value of an enumeration constant shall be an
integer
constant expression that has a value representable as an int."
So enum { A = 0xffffffff } is a constraint violation and not allowed by the
standard anyway. Such code was always non-conforming and relying on an
(undocumented?) GCC extension, so the standard has nothing to say about the
type.
More information about the Gcc-bugs
mailing list