https://gcc.gnu.org/g:2c27189da4de8a4ba005255fd3df6f3ac7064498
commit r15-3337-g2c27189da4de8a4ba005255fd3df6f3ac7064498 Author: Iain Sandoe <i...@sandoe.co.uk> Date: Sat Aug 31 12:42:36 2024 +0100 testsuite, c++, coroutines: Correct a test intent. The intention of the series of tests numberef pr95615-* is to verify that entities created by the ramp and potentially needing destruction are correctly handled when exceptions are thrown. Because of a typo, one case was not being checked correctly (the return object). This patch amends the check to test that the returned object is properly deleted. gcc/testsuite/ChangeLog: * g++.dg/coroutines/torture/pr95615.inc: Check tha the task object produced by get_return_object is correctly deleted on exception. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk> Diff: --- gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc b/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc index 5fc22430e991..b6f78fb15b9f 100644 --- a/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc +++ b/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc @@ -12,11 +12,11 @@ namespace std { bool frame_live = false; bool promise_live = false; -bool gro_live = false; struct X {}; int Y_live = 0; +int task_live = 0; struct Y { @@ -85,7 +85,6 @@ struct task { #if GET_RETURN_OBJECT_THROWS throw X{}; #endif - bool gro_live = true; return task{}; } @@ -96,12 +95,12 @@ struct task { } }; - task() { std::puts("task()"); } - ~task() { std::puts("~task()"); } - task(task&&) { std::puts("task(task&&)"); } + task() { std::puts("task()"); task_live++; } + ~task() { std::puts("~task()"); task_live--; } + task(task&&) { std::puts("task(task&&)"); task_live++; } }; -task f(Y Val) { +task f(Y Val __attribute__((__unused__))) { co_return; } @@ -112,8 +111,8 @@ int main() { f(Val); } catch (X) { std::puts("caught X"); - if (gro_live) - std::puts("gro live"), failed = true; + if (task_live) + std::puts("task live"), failed = true; if (promise_live) std::puts("promise live"), failed = true; if (frame_live)