PR c++/21983
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Sep 2005 16:34:58 +0000 (16:34 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Sep 2005 16:34:58 +0000 (16:34 +0000)
* 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.

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

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

index 4627b8b..b77388c 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-22  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-09-21  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/23993
index 7fdeb87..35e7cb9 100644 (file)
@@ -1906,11 +1906,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 %qD in %qT", fn,
-            BINFO_TYPE (derived));
-      return error_mark_node;
-    }
+    return error_mark_node;
 
   return ffod.candidates;
 }
@@ -1970,7 +1966,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 %qD in %qT", target_fn, t);
+      return;
+    }
   overrider_target = overrider_fn = TREE_PURPOSE (overrider);
 
   /* Check for adjusting covariant return types.  */
index 24cdbb2..d71ac3c 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/21983
+       * g++.dg/warn/pr21983.C: New test.
+
 2005-09-21  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/23993
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" }