]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: more name lookup for non-dep rewritten cmp ops
authorPatrick Palka <ppalka@redhat.com>
Fri, 25 Jul 2025 14:55:35 +0000 (10:55 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 25 Jul 2025 14:55:35 +0000 (10:55 -0400)
commitba5a6787374dea3e90f09771134d16b9f6d2714e
treec137f3970aa7b8ae019137c681bf48bbe6732984
parentcebf2a85d2de9aea3fa8ba0d8dc45945e56f0eb9
c++: more name lookup for non-dep rewritten cmp ops

As a follow-up to r16-2448-g7590c14b53a762, this patch attempts to teach
build_min_non_dep_op_overload how to rebuild all rewritten comparison
operators, not just != -> == ones, so that we don't incorrectly repeat
the unqualified name lookup at instantiation time.

Note that changes how we mangle such comparison ops, in a way that is
overall more consistent with how we've been mangling non-rewritten
operators, see PR c++/121239.

gcc/cp/ChangeLog:

* call.cc (build_new_op): If the selected candidate is
rewritten, communicate the LOOKUP_REWRITTEN/REVERSED flags to
the caller via the 'overload' out-parameter, and stop clearing
'*overload' in that case.
* tree.cc (build_min_non_dep_op_overload): Handle rebuilding all
C++20 rewritten comparison operator expressions.

gcc/testsuite/ChangeLog:

* g++.dg/lookup/operator-8.C: Remove XFAILs and properly
suppress all -Wunused-result warnings.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/call.cc
gcc/cp/tree.cc
gcc/testsuite/g++.dg/lookup/operator-8.C