re PR c++/21983 (multiple diagnostics)

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: r104533
This commit is contained in:
Jakub Jelinek 2005-09-22 18:34:58 +02:00 committed by Jakub Jelinek
parent 861fd9a03a
commit 16a1369ec3
4 changed files with 24 additions and 6 deletions

View 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

View 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. */

View 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

View File

@ -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" }