https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61568
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #1 from Harald van Dijk <harald at gigawatt dot nl> --- The C++ standard requires an unscoped enumeration type with an underlying type that is not fixed to promote to signed int, if signed int is capable of representing all the values in the enumeration's range. And the enumeration's range depends on the values of the enumeration constants, not on the enumeration's underlying type, so it requires this even if the underlying type is unsigned int. This may be confusing, but I think that what GCC implements is exactly what the standard requires, and that there is no bug in GCC here. This may indeed be a duplicate of bug 58559, which seems to be invalid for the same reason. In the comparison e < 0, e is promoted to signed int (except in C, where it does promote to unsigned int). In the cast (long long) e, the enumeration value (with an unsigned underlying type) is converted directly to long long, without any intermediate promotion.