From: Iain Sandoe Date: Sat, 31 Aug 2024 11:42:36 +0000 (+0100) Subject: testsuite, c++, coroutines: Correct a test intent. X-Git-Tag: basepoints/gcc-16~6216 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c27189da4de8a4ba005255fd3df6f3ac7064498;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc b/gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc index 5fc22430e99..b6f78fb15b9 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)