[Bug c++/101442] [9 Regression] Destructor not called for a temporary object, if it's bound to a ref member of an object subject to NRVO
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 13 17:41:49 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101442
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:48b8d5e028abee8869de946bbd7d24d746655d88
commit r9-10173-g48b8d5e028abee8869de946bbd7d24d746655d88
Author: Jason Merrill <jason@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.
More information about the Gcc-bugs
mailing list