Hi!

On the following testcase starting with r199779 we have a FIELD_DECL with
error_mark_node type, on which we ICE.  Fixed by ignoring such FIELD_DECLs.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2014-03-19  Jakub Jelinek  <ja...@redhat.com>

        PR c++/60572
        * init.c (build_zero_init_1): Ignore fields with error_mark_node
        type.

        * g++.dg/init/pr60572.C: New test.

--- gcc/cp/init.c.jj    2014-03-10 10:50:14.000000000 +0100
+++ gcc/cp/init.c       2014-03-19 07:43:54.077795662 +0100
@@ -192,6 +192,9 @@ build_zero_init_1 (tree type, tree nelts
          if (TREE_CODE (field) != FIELD_DECL)
            continue;
 
+         if (TREE_TYPE (field) == error_mark_node)
+           continue;
+
          /* Don't add virtual bases for base classes if they are beyond
             the size of the current field, that means it is present
             somewhere else in the object.  */
--- gcc/testsuite/g++.dg/init/pr60572.C.jj      2014-03-19 07:46:33.607894844 
+0100
+++ gcc/testsuite/g++.dg/init/pr60572.C 2014-03-19 07:46:49.752804722 +0100
@@ -0,0 +1,13 @@
+// PR c++/60572
+// { dg-do compile }
+
+struct A
+{
+  A x; // { dg-error "incomplete type" }
+  virtual ~A () {}
+};
+
+struct B : A
+{
+  B () : A () {}
+};

        Jakub

Reply via email to