diff options
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index b14462fd339..e893442be42 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -415,10 +415,12 @@ build_target_expr_with_type (tree init, tree type) if (TREE_CODE (init) == TARGET_EXPR) return init; else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type) + && !VOID_TYPE_P (TREE_TYPE (init)) && TREE_CODE (init) != COND_EXPR && TREE_CODE (init) != CONSTRUCTOR && TREE_CODE (init) != VA_ARG_EXPR) - /* We need to build up a copy constructor call. COND_EXPR is a special + /* We need to build up a copy constructor call. A void initializer + means we're being called from bot_manip. COND_EXPR is a special case because we already have copies on the arms and we don't want another one here. A CONSTRUCTOR is aggregate initialization, which is handled separately. A VA_ARG_EXPR is magic creation of an @@ -1468,17 +1470,17 @@ bot_manip (tree* tp, int* walk_subtrees, void* data) tree u; if (TREE_CODE (TREE_OPERAND (t, 1)) == AGGR_INIT_EXPR) - u = build_cplus_new - (TREE_TYPE (t), break_out_target_exprs (TREE_OPERAND (t, 1))); + u = build_cplus_new (TREE_TYPE (t), TREE_OPERAND (t, 1)); else - u = build_target_expr_with_type - (break_out_target_exprs (TREE_OPERAND (t, 1)), TREE_TYPE (t)); + u = build_target_expr_with_type (TREE_OPERAND (t, 1), TREE_TYPE (t)); /* Map the old variable to the new one. */ splay_tree_insert (target_remap, (splay_tree_key) TREE_OPERAND (t, 0), (splay_tree_value) TREE_OPERAND (u, 0)); + TREE_OPERAND (u, 1) = break_out_target_exprs (TREE_OPERAND (u, 1)); + /* Replace the old expression with the new version. */ *tp = u; /* We don't have to go below this point; the recursive call to |