https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102191

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:b10e031458d541f794dfaa08ba606487603a4bb6

commit r12-6333-gb10e031458d541f794dfaa08ba606487603a4bb6
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Jan 5 17:01:12 2022 -0500

    c++: destroy retval on throwing cleanup in try [PR33799]

    My earlier attempt to fix this bug didn't handle the case where both the
    return and the throwing cleanup are within a try-block that catches and
    discards the exception.  Fixed by adding the retval cleanup to any
    try-blocks as well as the function body.  PR102191 pointed out that we also
    weren't handling templates properly, so I moved the call out of the parser.

            PR c++/33799
            PR c++/102191

    gcc/cp/ChangeLog:

            * except.c (maybe_splice_retval_cleanup): Check
            current_binding_level.
            * semantics.c (do_poplevel): Call it here.
            * parser.c (cp_parser_compound_statement): Not here.

    gcc/testsuite/ChangeLog:

            * g++.dg/eh/return1.C: Add temporary in try block case.
            * g++.dg/cpp2a/constexpr-dtor11.C: New test.

Reply via email to