https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65509

--- Comment #6 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Jakub Jelinek from comment #5)
> const int i1 = 1;
> const int i2 = 2;
> constexpr auto b = &i1 == &i2;
> int main() {}
> 
> is now also rejected, when it used to be accepted.

Both behavioral changes look incorrect to me. The addresses of such global
objects are valid for equality comparison irrespective whether they are
constexpr or not, because == has no pre-condition:

"Two pointers compare equal if they are both null, both point to the same
function, or both represent the same address (3.9.2), otherwise they compare
unequal."

therefore we cannot fall into the exclusion bullet within 5.20 p2

"a relational (5.9) or equality (5.10) operator where the result is
unspecified;"

Reply via email to