]> gcc.gnu.org Git - gcc.git/commit
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>
Mon, 22 Mar 2021 22:02:59 +0000 (22:02 +0000)
commit88bb77a8dcf75f556b8dcb24b8785b4567d24e4f
tree227342d0e5554ab2c2f62aa967231941aa154478
parent9f13c7ad960a0f2e150dd2f668a8d155b76389db
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.

(cherry picked from commit b8ff3f8efeda02a6bedebfaf20b93645ae3bb5b8)
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]
This page took 0.062244 seconds and 6 git commands to generate.