coroutines: Fix handling of ramp return value [PR94661]
authorIain Sandoe <iain@sandoe.co.uk>
Tue, 21 Apr 2020 09:35:13 +0000 (10:35 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 21 Apr 2020 10:08:49 +0000 (11:08 +0100)
commitcd08718d57d1552fa2dbca96809e4915559685e7
tree37ffcf044fd423793a76e3882d07be0dd811d3fa
parente6cbe9654d14588f8bcaf267730fa4c694216eee
coroutines: Fix handling of ramp return value [PR94661]

Coroutine ramp functions have synthesised return values (the
user-authored function body cannot have an explicit 'return').
The current implementation attempts to optimise by building
the return in-place, in the manner of C++17 code. Clearly,
that was too ambitious and the fix builds a target expr for
the constructed version and passes that to finish_return_stmt.

This also means that we now get the same error messages for
implicit use of deleted CTORs etc.

gcc/cp/ChangeLog:

2020-04-21 Iain Sandoe <iain@sandoe.co.uk>

PR c++/94661
* coroutines.cc (morph_fn_to_coro): Simplify return
value computation.

gcc/testsuite/ChangeLog:

2020-04-21 Iain Sandoe <iain@sandoe.co.uk>

PR c++/94661
* g++.dg/coroutines/ramp-return-a.C: New test.
* g++.dg/coroutines/ramp-return-b.C: New test.
* g++.dg/coroutines/ramp-return-c.C: New test.
gcc/cp/ChangeLog
gcc/cp/coroutines.cc
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/coroutines/ramp-return-a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/coroutines/ramp-return-b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/coroutines/ramp-return-c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/coroutines/ramp-return.h [new file with mode: 0644]