c++: don't call 'rvalue' in coroutines code
A change to check glvalue_p rather than specifically for TARGET_EXPR
revealed issues with the coroutines code's use of the 'rvalue' function,
which shouldn't be used on class glvalues, so I've removed those calls.
In build_co_await I just dropped them, because I don't see anything in the
co_await specification that indicates that we would want to move from an
lvalue result of operator co_await. And simplified that code while I was
touching it; cp_build_modify_expr (...INIT_EXPR...) will call the
constructor.
In morph_fn_to_coro I changed the handling of the rvalue reference coroutine
frame field to use move, to treat the rval ref as an xvalue. I used
forward_parm to pass the function parms to the constructor for the field.
And I simplified the return handling so we get the desired rvalue semantics
from the normal implicit move on return.
I question default-initializing the non-void return value of the function if
get_return_object returns void; I'm not messing with it here, but I've filed
PR100476 about it.
gcc/cp/ChangeLog:
* coroutines.cc (build_co_await): Don't call 'rvalue'.
(flatten_await_stmt): Simplify initialization.
(morph_fn_to_coro): Change 'rvalue' to 'move'. Simplify.
gcc/testsuite/ChangeLog:
* g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C:
Adjust diagnostic.