https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95334
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- My guess is that G++ folds the constants early and the overflow happens at compile time, so is never seen by UBsan.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95334
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- My guess is that G++ folds the constants early and the overflow happens at compile time, so is never seen by UBsan.