diff options
author | Jason Merrill <jason@redhat.com> | 2019-12-19 09:06:45 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-12-19 09:06:45 -0500 |
commit | 942d334ec3fdf360dfedc0f97d1b4747a1f56f08 (patch) | |
tree | b27d4a2df27541a26c5d007a91095e2cff7fc3d1 /gcc/cp/tree.c | |
parent | 39f8777c403cbaf2603bbf2dec026c4d87e2dbb9 (diff) | |
download | gcc-942d334ec3fdf360dfedc0f97d1b4747a1f56f08.zip gcc-942d334ec3fdf360dfedc0f97d1b4747a1f56f08.tar.gz gcc-942d334ec3fdf360dfedc0f97d1b4747a1f56f08.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 7b5a3e4..42194cb 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -539,6 +539,16 @@ build_local_temp (tree type) return slot; } +/* Return whether DECL is such a local temporary. */ + +bool +is_local_temp (tree decl) +{ + return (VAR_P (decl) && DECL_ARTIFICIAL (decl) + && !TREE_STATIC (decl) + && DECL_FUNCTION_SCOPE_P (decl)); +} + /* Set various status flags when building an AGGR_INIT_EXPR object T. */ static void |