aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/init/new24.C18
4 files changed, 25 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f6ddb5e..e21bb0f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-21 Jakub Jelinek <jakub@redhat.com>
+
+ * init.c (build_new_1): Use get_target_expr instead of save_expr.
+
2007-08-20 Pawel Sikora <pluto@pld-linux.org>
PR c++/7302
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 1909319..ce33e42 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1755,7 +1755,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
placement_expr = NULL_TREE;
else
{
- placement_expr = save_expr (TREE_VALUE (placement));
+ placement_expr = get_target_expr (TREE_VALUE (placement));
placement = tree_cons (NULL_TREE, placement_expr, NULL_TREE);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 74321c8..4fc50ce 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,7 @@
2007-08-21 Jakub Jelinek <jakub@redhat.com>
+ * g++.dg/init/new24.C: New test.
+
PR middle-end/32912
* gcc.dg/pr32912-1.c: New test.
* gcc.dg/pr32912-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/init/new24.C b/gcc/testsuite/g++.dg/init/new24.C
new file mode 100644
index 0000000..6f5613b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/new24.C
@@ -0,0 +1,18 @@
+// PR c++/33025
+// { dg-do compile }
+// { dg-options "-O2" }
+
+typedef __SIZE_TYPE__ size_t;
+inline void *operator new (size_t, void *p) throw () { return p; }
+extern "C" void abort ();
+
+int
+main()
+{
+ const unsigned num = 10;
+ unsigned *data = new unsigned[num];
+ unsigned *ptr = new (data) unsigned (num);
+ static unsigned data2[10];
+ unsigned *ptr2 = new (&data2[0]) unsigned (10);
+ return 0;
+}