c++: Allow template rvalue-ref conv to bind to lvalue ref.
authorJason Merrill <jason@redhat.com>
Tue, 28 Jan 2020 17:26:10 +0000 (12:26 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 28 Jan 2020 19:53:58 +0000 (14:53 -0500)
commit14e320dbc10cc796fd7ca0b6c44e0c9ac0901da9
treed16e2448338d74b0e357588567b6b586a86307e1
parent845bb366adcf702331de3d8022fd0e1c1c918607
c++: Allow template rvalue-ref conv to bind to lvalue ref.

When I implemented the [over.match.ref] rule that a reference conversion
function needs to match l/rvalue of the target reference type it changed our
handling of this testcase.  It seems to me that our current behavior is what
the standard says, but it doesn't seem desirable, and all the other
compilers have our old behavior.  So let's limit the change to non-templates
until there's some clarification from the committee.

PR c++/90546
* call.c (build_user_type_conversion_1): Allow a template conversion
returning an rvalue reference to bind directly to an lvalue.
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp0x/rv-conv3.C [new file with mode: 0644]