c++: Fall through for arrays of T vs T cv [PR104996]
authorEd Catmur <ed@catmur.uk>
Mon, 18 Apr 2022 22:09:04 +0000 (23:09 +0100)
committerJason Merrill <jason@redhat.com>
Wed, 20 Apr 2022 14:15:21 +0000 (10:15 -0400)
commit5bde80f48bcc594658c788895ad1fd86d0916fc2
tree547e53800b8acec04789fbfb7a62fa4f51f501df
parent67ded3a1f5b667b4cb5eb2fee8a031e8e4060a7d
c++: Fall through for arrays of T vs T cv [PR104996]

If two arrays do not have the exact same element type including
qualification, this could be e.g. f(int (&&)[]) vs. f(int const (&)[]),
which can still be distinguished by the lvalue-rvalue tiebreaker.

By tightening this branch (in accordance with the letter of the Standard) we
fall through to the next branch, which tests whether they have different
element type ignoring qualification and returns 0 in that case; thus we only
actually fall through in the T[...] vs. T cv[...] case, eventually
considering the lvalue-rvalue tiebreaker at the end of compare_ics.

Signed-off-by: Ed Catmur <ed@catmur.uk>
PR c++/104996

gcc/cp/ChangeLog:

* call.cc (compare_ics): When comparing list-initialization
sequences, do not return early.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/initlist129.C: New test.
gcc/cp/call.cc
gcc/testsuite/g++.dg/cpp0x/initlist129.C [new file with mode: 0644]