[Bug c++/97587] [coroutines] promise_type constructor is called with original parameters, not parameter copies
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 25 19:34:34 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97587
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:
https://gcc.gnu.org/g:b8ff3f8efeda02a6bedebfaf20b93645ae3bb5b8
commit r11-7403-gb8ff3f8efeda02a6bedebfaf20b93645ae3bb5b8
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Mon Feb 15 16:13:36 2021 +0000
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.
More information about the Gcc-bugs
mailing list