Reduced from grub package: $ cat http.i int port; enum { HTTP_PORT, HTTP_MAX_CHUNK_SIZE = 0x80000000 } http_establish_file() { return 0 ? port : HTTP_PORT; } $ gcc http.i -c -Werror=sign-compare -O2 http.i: In function ‘http_establish_file’: http.i:8:14: error: operand of ‘?:’ changes signedness from ‘int’ to ‘enum <anonymous>’ due to unsignedness of other operand [-Werror=sign-compare] 8 | return 0 ? port : HTTP_PORT; | ^~~~ cc1: some warnings being treated as errors
This is a deliberate change: if any enumerators are outside the range of int, then all enumerators now have the enum type, rather than those outside the range of int having the enum type and those inside the range of int having type int. (The logic to determine the integer type with which the enum type is compatible is unchanged. In the case of this testcase, it produces unsigned int.) While, as noted in the commit message, the change could be made conditional on C2x mode if necessary, I'm doubtful if that would actually help grub; presumably they'd rather change things so they work in C2x mode rather than keeping using an older mode after -std=gnu2x is the default, or postponing the fix until then.
All right, I've just created upstream issue: https://savannah.gnu.org/bugs/index.php?63246
(In reply to Martin Liška from comment #2) > All right, I've just created upstream issue: > https://savannah.gnu.org/bugs/index.php?63246 Note I submitted a bug about not being able to put this URL in the see also field (PR 107333).
Closing this bug, since the new behavior is as intended.