https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70170
Bug ID: 70170 Summary: [6 regression] bogus not a constant expression error comparing pointer to array to null 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 example compiles successfully with 4.9.3 and 5 but fails with 6.0. Note that the older compilers issue "warning: the address of āsā will ever be NULL [-Waddress]" for the "p0 == 0" expression. GCC 6 does not. That seems like another regression. Without bisecting it I suspect the delayed folding changes to be responsible for both of these new problems. $ cat t.c && /build/gcc-trunk/gcc/xgcc -B/build/gcc-trunk/gcc -S -Wall -Wextra -Wpedantic -xc++ t.c struct S { int a, b[1]; } s; constexpr S *p0 = &s; constexpr int *q0 = p0->b; constexpr bool b0 = p0 == 0; constexpr bool b1 = q0 == 0; t.c:7:24: error: ā((((int*)(& s)) + 4u) == 0u)ā is not a constant expression constexpr bool b1 = q0 == 0; ~~~^~~~