[Bug c/107763] -Wreturn-type false-positive with fully-covered switch over enum
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Nov 19 19:19:59 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107763
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>The `a` can only have value `a::b`,
NO, it has a full range of the underlying type. For GCC, see
https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Structures-unions-enumerations-and-bit-fields-implementation.html#Structures-unions-enumerations-and-bit-fields-implementation
"Normally, the type is unsigned int if there are no negative values in the
enumeration, otherwise int. If -fshort-enums is specified, then if there are
negative values it is the first of signed char, short and int that can
represent all the values, otherwise it is the first of unsigned char, unsigned
short and unsigned int that can represent all the values.
On some targets, -fshort-enums is the default; this is determined by the ABI.
"
More information about the Gcc-bugs
mailing list