diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a45c8661b51..3319d7bb74b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-03-02 Simon Martin + + PR c++/28253 + * class.c (update_vtable_entry_for_fn): Properly handle invalid overriders + for thunks. + 2007-03-02 Geoffrey Keating * g++spec.c (lang_specific_driver): Add -lstdc++ when compiling diff --git a/gcc/cp/class.c b/gcc/cp/class.c index f24a2fec327..b39f5326686 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -2097,7 +2097,8 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals, fixed_offset, virtual_offset); } else - gcc_assert (!DECL_THUNK_P (fn)); + gcc_assert (DECL_INVALID_OVERRIDER_P (overrider_target) || + !DECL_THUNK_P (fn)); /* Assume that we will produce a thunk that convert all the way to the final overrider, and not to an intermediate virtual base. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 10c948793f3..cc6e940c5ca 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-03-02 Simon Martin + + PR c++/28253 + * g++.dg/inherit/covariant16.C: New test. + 2007-03-02 Geoffrey Keating * g++.dg/other/darwin-minversion-1.C: New. diff --git a/gcc/testsuite/g++.dg/inherit/covariant16.C b/gcc/testsuite/g++.dg/inherit/covariant16.C new file mode 100644 index 00000000000..828b5b8f1a6 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/covariant16.C @@ -0,0 +1,17 @@ +/* PR c++/28253 This used to ICE. */ +/* { dg-do "compile" } */ + +struct A +{ + virtual A* foo(); +}; + +struct B : virtual A +{ + virtual B* foo(); /* { dg-error "overriding" } */ +}; + +struct C : B +{ + virtual C& foo(); /* { dg-error "conflicting return type" } */ +};