tested on x86_64-darwin/linux powerpc64le-linux, pushed to trunk,
thanks
Iain

--- 8< ---

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>
---
 .../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 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)
-- 
2.39.2 (Apple Git-143)

Reply via email to