Consider parm types equivalence for operator rewrite tiebreaker.
authorJason Merrill <jason@redhat.com>
Tue, 19 Nov 2019 20:22:12 +0000 (15:22 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 19 Nov 2019 20:22:12 +0000 (15:22 -0500)
commit8d5d90878ea9731301d3a1af32a444e4772e65e4
tree97700c240dbdfff23fb6a4a626ad00d32e60b04a
parent9a8819b8828490a83eaf9d069a049e26211cc215
Consider parm types equivalence for operator rewrite tiebreaker.

The C++ committee continues to discuss how best to avoid breaking existing
code with the new rules for reversed operators.  A recent suggestion was to
base the tie-breaker on the parameter types of the candidates, which made a
lot of sense to me, so this patch implements that.

This patch also mentions that a candidate was reversed or rewritten when
printing the list of candidates, and warns about a comparison that becomes
recursive under the new rules.  There is no flag for this warning; people
can silence it by swapping the operands.

* call.c (same_fn_or_template): Change to cand_parms_match.
(joust): Adjust.
(print_z_candidate): Mark rewritten/reversed candidates.
(build_new_op_1): Warn about recursive call with reversed arguments.

From-SVN: r278465
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite4.C [new file with mode: 0644]