]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/21983 (multiple diagnostics)
authorJakub Jelinek <jakub@redhat.com>
Wed, 23 Nov 2005 13:53:15 +0000 (14:53 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 23 Nov 2005 13:53:15 +0000 (14:53 +0100)
PR c++/21983
* class.c (find_final_overrider): Move diagnostic about no unique final
overrider to...
(update_vtable_entry_for_fn): ... here.

* g++.dg/warn/pr21983.C: New test.

From-SVN: r107420

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/pr21983.C [new file with mode: 0644]

index 95b6845ce390c0a928e866b058cd8e60b95de6c1..ac46b8e9c4adfd3cde18e2997f7045904c307204 100644 (file)
@@ -1,3 +1,10 @@
+2005-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/21983
+       * class.c (find_final_overrider): Move diagnostic about no unique final
+       overrider to...
+       (update_vtable_entry_for_fn): ... here.
+
 2005-11-15  Jason Merrill  <jason@redhat.com>
 
        PR c++/24580
index 09daf118a80f9e50b090185f851ff7b34761182d..5a0d076a515ca931264d81b0cd6a79af638f128a 100644 (file)
@@ -2035,11 +2035,7 @@ find_final_overrider (tree derived, tree binfo, tree fn)
 
   /* If there was no winner, issue an error message.  */
   if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
-    {
-      error ("no unique final overrider for `%D' in `%T'", fn, 
-            BINFO_TYPE (derived));
-      return error_mark_node;
-    }
+    return error_mark_node;
 
   return ffod.candidates;
 }
@@ -2099,7 +2095,10 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
   /* Find the final overrider.  */
   overrider = find_final_overrider (TYPE_BINFO (t), b, target_fn);
   if (overrider == error_mark_node)
-    return;
+    {
+      error ("no unique final overrider for `%D' in `%T'", target_fn, t);
+      return;
+    }
   overrider_target = overrider_fn = TREE_PURPOSE (overrider);
   
   /* Check for adjusting covariant return types.  */
index 24095bc63f1f3de942c3735b71e75da77f46e87f..2def9c517a78121b964183fef7eb66f470684879 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/21983
+       * g++.dg/warn/pr21983.C: New test.
+
 2005-11-23  Alan Modra  <amodra@bigpond.net.au>
 
        PR middle-end/24950
diff --git a/gcc/testsuite/g++.dg/warn/pr21983.C b/gcc/testsuite/g++.dg/warn/pr21983.C
new file mode 100644 (file)
index 0000000..3021c3f
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/21983
+// { dg-do compile }
+
+struct B { virtual void foo () = 0; };
+struct D1 : public virtual B { virtual void foo () {} };
+struct D2 : public virtual B { virtual void foo () {} };
+struct D : public D1, public D2 { };   // { dg-warning "no unique final overrider" }