]> gcc.gnu.org Git - gcc.git/commit
c++: fix throwing cleanup with label
authorJason Merrill <jason@redhat.com>
Tue, 6 Jun 2023 19:31:23 +0000 (15:31 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 17 Nov 2023 00:21:04 +0000 (19:21 -0500)
commite62dd770afde1745c547d05c8163ee5cd639464b
tree90e269b9c63bd778be04e5652b79c4383e53d3cd
parentcc67ee72fdd844b4d916dcd29e82f678ed103658
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
gcc/cp/except.cc
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/eh/return1.C
This page took 0.07174 seconds and 6 git commands to generate.