... and this version passes testing. For real.

Paolo.

////////////////////////////
Index: cp/decl.c
===================================================================
--- cp/decl.c   (revision 237285)
+++ cp/decl.c   (working copy)
@@ -6002,6 +6002,13 @@ check_initializer (tree decl, tree init, int flags
   tree init_code = NULL;
   tree core_type;
 
+  if (init && init != error_mark_node
+      && TREE_TYPE (init) == error_mark_node)
+    {
+      TREE_TYPE (decl) = error_mark_node;
+      return NULL_TREE;
+    }
+
   /* Things that are going to be initialized need to have complete
      type.  */
   TREE_TYPE (decl) = type = complete_type (TREE_TYPE (decl));
Index: testsuite/g++.dg/inherit/crash6.C
===================================================================
--- testsuite/g++.dg/inherit/crash6.C   (revision 0)
+++ testsuite/g++.dg/inherit/crash6.C   (working copy)
@@ -0,0 +1,10 @@
+// PR c++/70202
+
+class A
+{
+  virtual void foo () { }
+};
+class B : public A, A { };  // { dg-error "duplicate base type" }
+
+B b1, &b2 = b1;  // { dg-error "incomplete type" }
+A a = b2;

Reply via email to