https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107861
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- To expand on that, the standard allows compilers to do anything for undefined behaviour, including making it valid with well-defined semantics. So wrapping for undefined overflow is a conforming extension. But the outcome of overflow in a constant expression is not undefined, so the implementation isn't allowed to choose the behaviour. It has to be ill-formed (although maybe that could be a pedantic warning when -fwrapv is used).