https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70323
Bug ID: 70323 Summary: [6 regression] missing error on integer overflow in constexpr function result converted to bool Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- The following invalid program is rejected by GCC 5 with two errors, one due to each of the two erroneous calls to the constexpr functions. The program is now accepted by GCC 6.0. The errors are restored when bool is replaced with int. The first invalid call became accepted as a result of r233878. The second one sometime last week (after r234169). $ cat t.c && /build/gcc-trunk/gcc/xgcc -B/build/gcc-trunk/gcc -S -Wall -Wextra -Wpedantic -o/dev/null -xc++ t.c constexpr int overflow_if_0 (int i) { return __INT_MAX__ + !i; } constexpr int overflow_if_1 (int i) { return __INT_MAX__ + i; } constexpr bool i0_0 = overflow_if_0 (0); // error expected constexpr bool i0_1 = overflow_if_0 (1); constexpr bool i1_0 = overflow_if_1 (0); constexpr bool i1_1 = overflow_if_1 (1); // error expected $