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.