c++: TARGET_EXPR_ELIDING_P and std::move [PR107267]
commit4cbc71691e47b1ca6b64feb0af678606705d2f92
authorJason Merrill <jason@redhat.com>
Mon, 23 Jan 2023 22:14:11 +0000 (23 17:14 -0500)
committerJason Merrill <jason@redhat.com>
Mon, 23 Jan 2023 23:35:11 +0000 (23 18:35 -0500)
treec3f5b175c0ad4ff4e3e7e7ac8574e254251e018f
parent51767f31878a95161142254dca7119b409699670
c++: TARGET_EXPR_ELIDING_P and std::move [PR107267]

With -ffold-simple-inlines, we turn calls to std::move into the static_cast
equivalent.  In this testcase, this exposes the FindResult temporary to copy
elision which is not specified by the standard, through an optimization in
gimplify_modify_expr_rhs.  Since the type is not TREE_ADDRESSABLE, this is
not detectable by the user, so we just need to soften the assert.

PR c++/107267

gcc/cp/ChangeLog:

* cp-gimplify.cc (cp_gimplify_init_expr): Allow unexpected elision
of trivial types.

gcc/testsuite/ChangeLog:

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