https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70135
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I see -fsanitize=bounds replaces bs[i++] with bs[UBSAN_BOUNDS (0B, SAVE_EXPR <i++>, 4), SAVE_EXPR <i++>] I believe the constexpr folding is properly removing the UBSAN_BOUNDS stuff, but the problem is most likely in the SAVE_EXPR. At least, if I by hand replace bs[i++] with just bs[SAVE_EXPR <i++>] then the static assertion fails too.