aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2020-06-04 17:14:37 +0100
committerIain Sandoe <iain@sandoe.co.uk>2020-06-04 19:26:18 +0100
commit4f2d05ef0142d269964e165c14c6f7fe4bdfd5a3 (patch)
tree5daf10eeceaa56efd48462880df814b2fdc81e2f /gcc/cp/class.c
parente7ef9a40cd0c688cd331bc26224d1fbe360c1fe6 (diff)
downloadgcc-4f2d05ef0142d269964e165c14c6f7fe4bdfd5a3.zip
gcc-4f2d05ef0142d269964e165c14c6f7fe4bdfd5a3.tar.gz
gcc-4f2d05ef0142d269964e165c14c6f7fe4bdfd5a3.tar.bz2
coroutines: Fix missed ramp function return copy elision [PR95346].
Confusingly, "get_return_object ()" can do two things: - Firstly it can provide the return object for the ramp function (as the name suggests). - Secondly if the type of the ramp function is different from that of the get_return_object call, this is used as a single parameter to a CTOR for the ramp's return type. In the first case we can rely on finish_return_stmt () to do the necessary processing for copy elision. In the second case, we should have passed a prvalue to the CTOR as per the standard comment, but I had omitted the rvalue () call. Fixed thus. gcc/cp/ChangeLog: PR c++/95346 * coroutines.cc (morph_fn_to_coro): Ensure that the get- return-object is constructed correctly; When it is not the final return value, pass it to the CTOR of the return type as an rvalue, per the standard comment. gcc/testsuite/ChangeLog: PR c++/95346 * g++.dg/coroutines/pr95346.C: New test.
Diffstat (limited to 'gcc/cp/class.c')
0 files changed, 0 insertions, 0 deletions