coroutines : Call promise CTOR with parm copies [PR97587].
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 15 Feb 2021 16:13:36 +0000 (16:13 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 25 Feb 2021 19:24:52 +0000 (19:24 +0000)
commitb8ff3f8efeda02a6bedebfaf20b93645ae3bb5b8
tree87d97f7bc9458a6334c8431af597e447d591de48
parent7005a50d0121954031a223ea5a6c57aaa7e3efd3
coroutines : Call promise CTOR with parm copies [PR97587].

As the PR notes, we were calling the promise CTOR with the original
function parameters, not the copy (as pointed, a previous wording of
the section was unambiguous).  Fixed thus.

gcc/cp/ChangeLog:

PR c++/97587
* coroutines.cc (struct param_info): Track rvalue refs.
(morph_fn_to_coro): Track rvalue refs, and call the promise
CTOR with the frame copy of passed parms.

gcc/testsuite/ChangeLog:

PR c++/97587
* g++.dg/coroutines/coro1-refs-and-ctors.h: Add a CTOR with two
reference parms, to distinguish the rvalue ref. variant.
* g++.dg/coroutines/pr97587.C: New test.
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/coro1-refs-and-ctors.h
gcc/testsuite/g++.dg/coroutines/pr97587.C [new file with mode: 0644]