diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2024-08-31 12:42:36 +0100 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2024-08-31 17:31:39 +0100 |
commit | 2c27189da4de8a4ba005255fd3df6f3ac7064498 (patch) | |
tree | 4e322fc85e9622ecd9ca3a4ef380643c6564d710 | |
parent | 049a927c100f8ee86ccd71711d70077b0336e966 (diff) | |
download | gcc-2c27189da4de8a4ba005255fd3df6f3ac7064498.zip gcc-2c27189da4de8a4ba005255fd3df6f3ac7064498.tar.gz gcc-2c27189da4de8a4ba005255fd3df6f3ac7064498.tar.bz2 |
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 <iain@sandoe.co.uk>
-rw-r--r-- | gcc/testsuite/g++.dg/coroutines/torture/pr95615.inc | 15 |
1 files 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 5fc2243..b6f78fb 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) |