https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33799
--- Comment #11 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:bcfc2227c556f2801a657ce3007374732baa8333 commit r10-6077-gbcfc2227c556f2801a657ce3007374732baa8333 Author: Jason Merrill <ja...@redhat.com> Date: Sun Jan 19 09:14:54 2020 -0500 PR c++/33799 - destroy return value, take 2. This patch differs from the reverted patch for 33799 in that it adds the CLEANUP_STMT for the return value at the end of the function, and only if we've seen a cleanup that might throw, so it should not affect most C++11 code. * cp-tree.h (current_retval_sentinel): New macro. (struct language_function): Add throwing_cleanup bitfield. * decl.c (cxx_maybe_build_cleanup): Set it. * except.c (maybe_set_retval_sentinel) (maybe_splice_retval_cleanup): New functions. * parser.c (cp_parser_compound_statement): Call maybe_splice_retval_cleanup. * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.