https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113347
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:713fbaff8b17a01d3b72110f89112851ed43a90a commit r13-8249-g713fbaff8b17a01d3b72110f89112851ed43a90a Author: Jason Merrill <ja...@redhat.com> Date: Tue Jan 23 15:41:09 2024 -0500 c++: throwing cleanup after return [PR113347] Here we were assuming that current_retval_sentinel would be set if we have seen a throwing cleanup, but that's not the case if the cleanup is after all returns. This change isn't needed on trunk, where current_retval_sentinel is set for all NRV functions. PR c++/113347 gcc/cp/ChangeLog: * semantics.cc (finalize_nrv_r): Handle null current_retval_sentinel. gcc/testsuite/ChangeLog: * g++.dg/eh/return3.C: New test.