PR c++/66139 - EH cleanups for partially constructed aggregates.
authorJason Merrill <jason@redhat.com>
Thu, 19 Dec 2019 14:06:45 +0000 (09:06 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 19 Dec 2019 14:06:45 +0000 (09:06 -0500)
commit942d334ec3fdf360dfedc0f97d1b4747a1f56f08
treeb27d4a2df27541a26c5d007a91095e2cff7fc3d1
parent39f8777c403cbaf2603bbf2dec026c4d87e2dbb9
PR c++/66139 - EH cleanups for partially constructed aggregates.

There were several overlapping PRs about failure to clean up fully
constructed subobjects when an exception is thrown during aggregate
initialization of a temporary.  I fixed this for non-temporaries in the
context of 57510, but that fix didn't handle temporaries.  So this patch
does split_nonconstant_init at gimplification time, which is much smaller
than alternatives I tried.

PR c++/57510
* cp-gimplify.c (cp_gimplify_init_expr): Use split_nonconstant_init.
* typeck2.c (split_nonconstant_init): Handle non-variable dest.
(split_nonconstant_init_1): Clear TREE_SIDE_EFFECTS.
* tree.c (is_local_temp): New.

From-SVN: r279576
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/cp/cp-tree.h
gcc/cp/tree.c
gcc/cp/typeck2.c
gcc/testsuite/g++.dg/cpp0x/initlist116.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/initlist117.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C