]> 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>
Fri, 13 May 2022 17:39:30 +0000 (13:39 -0400)
commit3daf541e8fe2dd0807a3dd49a9b8c065d7d46731
treeefcf48273061037cba5dd0c05ac44d958388ba23
parent623842bead8452c03f2b1c6817f2a86a1d2d4d12
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.c (build_over_call): Use cp_build_indirect_ref.

gcc/testsuite/ChangeLog:

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