aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-04-01 17:18:23 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-04-01 17:18:23 -0400
commit879b0a1db9b13b1cb3632c974178d05c70ed8d57 (patch)
treea7030ed6628d0920e1e6e987315af27e7e06bfa7 /gcc
parentc53d966d3176a8ebe1f88ad1b87a8a9e2bfbb96c (diff)
downloadgcc-879b0a1db9b13b1cb3632c974178d05c70ed8d57.zip
gcc-879b0a1db9b13b1cb3632c974178d05c70ed8d57.tar.gz
gcc-879b0a1db9b13b1cb3632c974178d05c70ed8d57.tar.bz2
re PR c++/56772 (placement new operator does not work inside function template for array types.)
PR c++/56772 * init.c (build_new): Don't try to process an array initializer at template definition time. From-SVN: r197326
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/init.c1
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist68.C20
3 files changed, 25 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7e58f70..6374fff 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2013-04-01 Jason Merrill <jason@redhat.com>
+ PR c++/56772
+ * init.c (build_new): Don't try to process an array initializer
+ at template definition time.
+
PR c++/56793
* typeck.c (finish_class_member_access_expr): Handle enum scope.
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index ab6af14..7b7de02 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2920,6 +2920,7 @@ build_new (vec<tree, va_gc> **placement, tree type, tree nelts,
if (dependent_type_p (type)
|| any_type_dependent_arguments_p (*placement)
|| (nelts && type_dependent_expression_p (nelts))
+ || (nelts && *init)
|| any_type_dependent_arguments_p (*init))
return build_raw_new_expr (*placement, type, nelts, *init,
use_global_new);
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist68.C b/gcc/testsuite/g++.dg/cpp0x/initlist68.C
new file mode 100644
index 0000000..7cfe1a3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist68.C
@@ -0,0 +1,20 @@
+// PR c++/56772
+// { dg-require-effective-target c++11 }
+
+typedef __SIZE_TYPE__ size_t;
+void* operator new[](size_t, void *p) { return p; }
+template <typename T = size_t>
+void f ()
+{
+ size_t coord [2][2];
+ new (&coord) size_t [2][2]
+ {
+ {0,0},
+ {0,0},
+ };
+}
+
+int main ()
+{
+ f<>();
+}