OSDN Git Service

2006-09-14 Andrew Pinski <pinskia@physics.uc.edu>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Sep 2006 04:50:04 +0000 (04:50 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Sep 2006 04:50:04 +0000 (04:50 +0000)
        PR C++/29002
        * init.c (build_zero_init): If we have an error mark node for
        the array size, return.

2006-09-14  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/29002
        * g++.dg/init/array22.C: New test.
        * g++.dg/init/array23.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116962 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/init.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/array22.C [new file with mode: 0644]
gcc/testsuite/g++.dg/init/array23.C [new file with mode: 0644]

index bcb6dc8..1123643 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-14  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR C++/29002
+       * init.c (build_zero_init): If we have an error mark node for
+       the array size, return.
+
 2006-09-10  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/28991
index ad40736..8faa03d 100644 (file)
@@ -223,6 +223,11 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
                                 nelts, integer_one_node);
       else
        max_index = array_type_nelts (type);
+
+      /* If we have an error_mark here, we should just return error mark
+        as we don't know the size of the array yet.  */
+      if (max_index == error_mark_node)
+       return error_mark_node;
       gcc_assert (TREE_CODE (max_index) == INTEGER_CST);
 
       /* A zero-sized array, which is accepted as an extension, will
index f1581fa..fd06af6 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-14  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR C++/29002
+       * g++.dg/init/array22.C: New test.
+       * g++.dg/init/array23.C: New test.
+
 2006-09-14  Arnaud Charlet  <charlet@adacore.com>
 
        * stackcheck.lst: Update list of tests requiring stack checking.
diff --git a/gcc/testsuite/g++.dg/init/array22.C b/gcc/testsuite/g++.dg/init/array22.C
new file mode 100644 (file)
index 0000000..0c5bb33
--- /dev/null
@@ -0,0 +1,6 @@
+// PR C++/29002
+// We ICE trying to set the "zero" initializer on the incomplete
+//  array
+
+struct A {};
+int A::* x[]; // { dg-error "size" }
diff --git a/gcc/testsuite/g++.dg/init/array23.C b/gcc/testsuite/g++.dg/init/array23.C
new file mode 100644 (file)
index 0000000..80ffb0a
--- /dev/null
@@ -0,0 +1,6 @@
+// PR C++/29002
+// We ICE trying to set the "zero" initializer on the incomplete
+//  array
+
+struct A {A();int A::* t;};
+A x[]; // { dg-error "size" }