2018-03-22 Alexandre Oliva <aoliva@redhat.com>
+ PR c++/84729
+ * init.c (build_vec_init): Error at parenthesized array init.
+
PR c++/84610
PR c++/84642
PR c++/84942
else if (*init)
{
if (complain & tf_error)
- permerror (input_location,
- "parenthesized initializer in array new");
- else
- return error_mark_node;
- vecinit = build_tree_list_vec (*init);
+ error ("parenthesized initializer in array new");
+ return error_mark_node;
}
init_expr
= build_vec_init (data_addr,
+2018-03-22 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/84729
+ * g++.dg/pr84729.C: New.
+ * g++.old-deja/g++.ext/arrnew2.C: Require error.
+ * g++.old-deja/g++.robertl/eb58.C: Likewise.
+ * g++.old-deja/g++.robertl/eb63.C: Likewise.
+
2018-03-22 Steven G. Kargl <kargl@gcc.gnu.org
PR fortran/84922
--- /dev/null
+// { dg-do compile }
+// { dg-options "-fpermissive" }
+
+typedef int b[2];
+void a() {
+ new b(a); // { dg-error "parenthesized initializer in array new" }
+}
-// { dg-do run }
+// { dg-do compile }
// { dg-options "-w -fpermissive" }
-int *foo = new int[1](42); // { dg-bogus "" }
+int *foo = new int[1](42); // { dg-error "parenthesized" }
int main ()
{
return foo[0] != 42;
-// { dg-do run }
+// { dg-do compile }
// { dg-options "-w -fpermissive" }
// Test for g++ array init extension
main()
{
- A *list = new A[10](4);
+ A *list = new A[10](4); // { dg-error "parenthesized" }
}
-// { dg-do run }
+// { dg-do compile }
// { dg-options "-w -fpermissive" }
//This uses GNU extensions, so disable -ansi
#include <stdio.h>
main() {
A* a;
- a = new A[2](1,false);
+ a = new A[2](1,false); // { dg-error "parenthesized" }
}