]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: assignment to temporary [PR59950]
authorJason Merrill <jason@redhat.com>
Mon, 24 Jan 2022 05:01:40 +0000 (00:01 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 25 Jan 2022 19:28:13 +0000 (14:28 -0500)
commitfe5cee6f62a0b229d9d51616b7490331d39b5ddd
tree19f36ed614a0e14b4d8f1e5b536d490c80e790ad
parentaeac414923aa1e87986c7fc6f9b921d89a9b86cf
c++: assignment to temporary [PR59950]

Given build_this of a TARGET_EXPR, cp_build_fold_indirect_ref returns the
TARGET_EXPR.  But that's the wrong value category for the result of the
defaulted class assignment operator, which returns an lvalue, so we need to
actually build the INDIRECT_REF.

PR c++/59950

gcc/cp/ChangeLog:

* call.cc (build_over_call): Use cp_build_indirect_ref.

gcc/testsuite/ChangeLog:

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