https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101442
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:f9e356458d8f14b5a82f3244385ce814903fc02b commit r11-9995-gf9e356458d8f14b5a82f3244385ce814903fc02b Author: Jason Merrill <ja...@redhat.com> Date: Wed Apr 13 13:23:08 2022 -0400 c++: NRV and ref-extended temps [PR101442] This issue goes back to r83221, where the cleanup for extended ref temps changed from being unconditional to being tied to the declaration they formed part of the initializer for. The named return value optimization changes the cleanup for the NRV variable to only run on the EH path; we don't want that change to affect temporary cleanups. The perform_member_init change isn't necessary (there 'decl' is a COMPONENT_REF), it's just for consistency. PR c++/101442 gcc/cp/ChangeLog: * decl.c (cp_finish_decl): Don't pass decl to push_cleanup. * init.c (perform_member_init): Likewise. * semantics.c (push_cleanup): Adjust comment. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist-nrv1.C: New test.