OSDN Git Service

/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 May 2010 19:31:47 +0000 (19:31 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 May 2010 19:31:47 +0000 (19:31 +0000)
2010-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/30298
* decl.c (xref_basetypes): Return false in case of ill-formed
redefinition.

/testsuite
2010-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/30298
* g++.dg/inherit/crash1.C: New.
* g++.dg/inherit/crash2.C: Likewise.

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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/crash1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/inherit/crash2.C [new file with mode: 0644]

index 68d461e..8e6cd75 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/30298
+       * decl.c (xref_basetypes): Return false in case of ill-formed
+       redefinition.
+
 2010-05-19  Jason Merrill  <jason@redhat.com>
 
        * call.c (reference_binding): Use cp_build_qualified_type_real
index 43a6bc3..95ae8eb 100644 (file)
@@ -11025,7 +11025,12 @@ xref_basetypes (tree ref, tree base_list)
 
   /* The binfo slot should be empty, unless this is an (ill-formed)
      redefinition.  */
-  gcc_assert (!TYPE_BINFO (ref) || TYPE_SIZE (ref));
+  if (TYPE_BINFO (ref) && !TYPE_SIZE (ref))
+    {
+      error ("redefinition of %q#T", ref);
+      return false;
+    }
+
   gcc_assert (TYPE_MAIN_VARIANT (ref) == ref);
 
   binfo = make_tree_binfo (max_bases);
index d50e8ba..d4c10f3 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/30298
+       * g++.dg/inherit/crash1.C: New.
+       * g++.dg/inherit/crash2.C: Likewise.
+
 2010-05-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/44178
@@ -6,7 +12,8 @@
 2010-05-20  Changpeng Fang  <changpeng.fang@amd.com>
 
        PR middle-end/44185
-       * gcc.dg/tree-ssa/prefetch-6.c: Add --param min-insn-to-prefetch-ratio=6.
+       * gcc.dg/tree-ssa/prefetch-6.c: Add
+       --param min-insn-to-prefetch-ratio=6.
        * gcc.dg/tree-ssa/prefetch-7.c: Remove --param max-unrolled-insns=1 to
         allow unrolling, and adjust the movnti count.
 
diff --git a/gcc/testsuite/g++.dg/inherit/crash1.C b/gcc/testsuite/g++.dg/inherit/crash1.C
new file mode 100644 (file)
index 0000000..d5eb7c2
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/30298
+
+union A {};
+
+struct B : A {}; // { dg-error "fails to be a struct or class type" }
+struct B : A {}; // { dg-error "redefinition" }
diff --git a/gcc/testsuite/g++.dg/inherit/crash2.C b/gcc/testsuite/g++.dg/inherit/crash2.C
new file mode 100644 (file)
index 0000000..0d82f77
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/30298
+
+struct A {};
+
+struct B : A, A {}; // { dg-error "duplicate base type" }
+struct B : A, A {}; // { dg-error "redefinition" }