c++: tweak c++17 ctor/conversion tiebreaker [DR2327]
commit4ec6b627cb008e31ea3d1ee93a209297f56c6a3e
authorJason Merrill <jason@redhat.com>
Fri, 3 Mar 2023 20:04:25 +0000 (3 15:04 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 14 Jun 2023 14:03:09 +0000 (14 10:03 -0400)
tree58b23f334e82e421105a21051d6253cfa3b15a0d
parent29aef9ff236022ebf566738f9bd08bb5e28fe6ca
c++: tweak c++17 ctor/conversion tiebreaker [DR2327]

In discussion of this issue CWG decided that the change of behavior on
well-formed code like overload-conv-4.C is undesirable.  In further
discussion of possible resolutions, we discovered that we can avoid that
change while still getting the desired behavior on overload-conv-3.C by
making this a tiebreaker after comparing conversions, rather than before.
This also simplifies the implementation.

The issue resolution has not yet been finalized, but this seems like a clear
improvement.

DR 2327
PR c++/86521

gcc/cp/ChangeLog:

* call.cc (joust_maybe_elide_copy): Don't change cand.
(joust): Move the elided tiebreaker later.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/overload-conv-4.C: Remove warnings.
* g++.dg/cpp1z/elide7.C: New test.
gcc/cp/call.cc
gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C
gcc/testsuite/g++.dg/cpp1z/elide7.C [new file with mode: 0644]