Message ID | 23BAA99B-1F97-4194-83DD-DF1352E6B52D@sandoe.co.uk |
---|---|
State | New |
Headers | show |
Series | [pushed] coroutines: Avoid functions with unlowered coroutine trees [PR95087]. | expand |
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index f3cf242b4f1..0abc579e0cb 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -3585,6 +3585,9 @@ morph_fn_to_coro (tree orig, tree *resumer, tree *destroyer) ramp return value, since the user cannot fix this - a 'return' is not allowed in a coroutine. */ TREE_NO_WARNING (orig) = true; + /* Discard the body, we can't process it further. */ + pop_stmt_list (DECL_SAVED_TREE (orig)); + DECL_SAVED_TREE (orig) = push_stmt_list (); return false; } diff --git a/gcc/testsuite/g++.dg/coroutines/co-return-syntax-08-bad-return.C b/gcc/testsuite/g++.dg/coroutines/co-return-syntax-08-bad-return.C index 4bfa41cd4a9..9b537548791 100644 --- a/gcc/testsuite/g++.dg/coroutines/co-return-syntax-08-bad-return.C +++ b/gcc/testsuite/g++.dg/coroutines/co-return-syntax-08-bad-return.C @@ -1,4 +1,4 @@ -// { dg-additional-options "-fsyntax-only -w" } +// { dg-additional-options "-w" } #include "coro.h"