summaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-20 07:53:58 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-20 07:53:58 +0000
commit39c947169f037056162b6e52c7fa3c3825567840 (patch)
treec2c802aba74aa922e346224b83ab6282792c8007 /gcc/cp/init.c
parent184e9f8f35c84faf9b993a401d5e5cf5d8fa8bae (diff)
downloadgcc-39c947169f037056162b6e52c7fa3c3825567840.tar.gz
PR c++/33025
* init.c (build_new_1): Rename placement_var variable to placement_expr. Initialize it with save_expr rather than get_temp_regvar. * g++.dg/init/new23.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127639 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 08f8b76f8c5..3c74812e01a 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1656,7 +1656,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
beginning of the storage allocated for an array-new expression in
order to store the number of elements. */
tree cookie_size = NULL_TREE;
- tree placement_var;
+ tree placement_expr;
/* True if the function we are calling is a placement allocation
function. */
bool placement_allocation_fn_p;
@@ -1749,17 +1749,16 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
alloc_fn = NULL_TREE;
/* If PLACEMENT is a simple pointer type, then copy it into
- PLACEMENT_VAR. */
+ PLACEMENT_EXPR. */
if (processing_template_decl
|| placement == NULL_TREE
|| TREE_CHAIN (placement) != NULL_TREE
|| TREE_CODE (TREE_TYPE (TREE_VALUE (placement))) != POINTER_TYPE)
- placement_var = NULL_TREE;
+ placement_expr = NULL_TREE;
else
{
- placement_var = get_temp_regvar (TREE_TYPE (TREE_VALUE (placement)),
- TREE_VALUE (placement));
- placement = tree_cons (NULL_TREE, placement_var, NULL_TREE);
+ placement_expr = save_expr (TREE_VALUE (placement));
+ placement = tree_cons (NULL_TREE, placement_expr, NULL_TREE);
}
/* Allocate the object. */
@@ -1857,7 +1856,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
{
rval = build_nop (pointer_type, alloc_call);
if (placement != NULL)
- rval = avoid_placement_new_aliasing (rval, placement_var);
+ rval = avoid_placement_new_aliasing (rval, placement_expr);
return rval;
}
@@ -2122,7 +2121,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
gcc_assert (!lvalue_p (rval));
if (placement != NULL)
- rval = avoid_placement_new_aliasing (rval, placement_var);
+ rval = avoid_placement_new_aliasing (rval, placement_expr);
return rval;
}