]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/29002 (ICE on array of ptr-to-member or struct containing ptr-to-member...
authorAndrew Pinski <pinskia@physics.uc.edu>
Wed, 11 Oct 2006 14:55:07 +0000 (14:55 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 11 Oct 2006 14:55:07 +0000 (07:55 -0700)
2006-10-11  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-10-11  Andrew Pinski  <pinskia@physics.uc.edu>

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

From-SVN: r117635

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 2323905c53407447d82f403fd892962651e88e3d..788e393d0fcc92da1f88423e055c62d805150376 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-11  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-10-10  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR C++/28450
index 95026fd51a6b16fc9c079cf7e446e994b95905ea..a8249e7f452cb92d36e9b7ef60e834a60152bc37 100644 (file)
@@ -227,6 +227,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 fa28b43ae3157263e54f5bed33bed35bae41d845..c28ad3893cf55517c154bd908ca95cdcc17f288d 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-11  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR C++/29002
+       * g++.dg/init/array22.C: New test.
+       * g++.dg/init/array23.C: New test.
+
 2006-10-10  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR C++/28450
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" }