From 08cea4e56a094ff9cc7c65fdc9ce8c4d7aff64be Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 6 Jun 2023 15:31:23 -0400 Subject: c++: fix throwing cleanup with label While looking at PR92407 I noticed that the expectations of maybe_splice_retval_cleanup weren't being met; an sk_cleanup level was confusing its attempt to recognize the outer block of the function. And even if I fixed the detection, it failed to actually wrap the body of the function because the STATEMENT_LIST it got only had the label, not anything after it. So I moved the call after poplevel does pop_stmt_list on all the sk_cleanup levels. PR c++/33799 gcc/cp/ChangeLog: * except.cc (maybe_splice_retval_cleanup): Change recognition of function body and try scopes. * semantics.cc (do_poplevel): Call it after poplevel. (at_try_scope): New. * cp-tree.h (maybe_splice_retval_cleanup): Adjust. gcc/testsuite/ChangeLog: * g++.dg/eh/return1.C: Add label cases. --- gcc/cp/cp-tree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/cp/cp-tree.h') diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 101da35..834fdd1 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7047,7 +7047,7 @@ extern tree begin_eh_spec_block (void); extern void finish_eh_spec_block (tree, tree); extern tree build_eh_type_type (tree); extern tree cp_protect_cleanup_actions (void); -extern void maybe_splice_retval_cleanup (tree); +extern void maybe_splice_retval_cleanup (tree, bool); extern tree maybe_set_retval_sentinel (void); extern tree template_parms_to_args (tree); -- cgit v1.1