]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: operator!= rewriting and arg-dep lookup
authorJason Merrill <jason@redhat.com>
Tue, 1 Apr 2025 17:04:05 +0000 (13:04 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 3 Apr 2025 15:19:30 +0000 (11:19 -0400)
commitbd5597156ca0c7d6fb50c6fe92a7abe6717cb2b5
treea2dff69fe1420d8f748f70722b6b6c0f5d33b665
parent26e9139691ac73f53fad64960a0ea48830adfa52
c++: operator!= rewriting and arg-dep lookup

When considering an op== as a rewrite target, we need to disqualify it if
there is a matching op!= in the same scope.  But add_candidates was assuming
that we could use the same set of op!= for all op==, which is wrong if
arg-dep lookup finds op== in multiple namespaces.

This broke 20_util/optional/relops/constrained.cc if the order of the ADL
set changed.

gcc/cp/ChangeLog:

* call.cc (add_candidates): Re-lookup ne_fns if we move into
another namespace.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-rewrite6.C: New test.
gcc/cp/call.cc
gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite6.C [new file with mode: 0644]