[Bug c++/95477] [coroutines] coroutine result object not properly freed
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 25 13:35:22 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95477
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Iain D Sandoe
<iains@gcc.gnu.org>:
https://gcc.gnu.org/g:d9b3aa517bdab280bbde2a80a80a77ad7333a0cb
commit r10-8369-gd9b3aa517bdab280bbde2a80a80a77ad7333a0cb
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Thu Jun 25 14:33:23 2020 +0100
coroutines: Add a cleanup expression for g-r-o when needed [PR95477].
The PR reports that we fail to destroy the object initially created from
the get-return-object call. Fixed by adding a cleanup when the DTOR is
non-trivial. In addition, to meet the specific wording that the call to
get_return_object creates the glvalue for the return, we must construct
that in-place in the return object to avoid a second copy/move CTOR.
gcc/cp/ChangeLog:
PR c++/95477
* coroutines.cc (morph_fn_to_coro): Apply a cleanup to
the get return object when the DTOR is non-trivial.
gcc/testsuite/ChangeLog:
PR c++/95477
* g++.dg/coroutines/pr95477.C: New test.
* g++.dg/coroutines/void-gro-non-class-coro.C: New test.
(cherry picked from commit 788b962aa00959e861b45767c5c88ec41ca30c21)
More information about the Gcc-bugs
mailing list