2007-03-02 Simon Martin <simartin@users.sourceforge.net>
authorsimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Mar 2007 22:09:20 +0000 (22:09 +0000)
committersimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Mar 2007 22:09:20 +0000 (22:09 +0000)
PR c++/28253
* class.c (update_vtable_entry_for_fn): Properly handle invalid overriders
for thunks.

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

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

index a45c866..3319d7b 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-02  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c++/28253
+       * class.c (update_vtable_entry_for_fn): Properly handle invalid overriders
+       for thunks.
+
 2007-03-02  Geoffrey Keating  <geoffk@apple.com>
 
        * g++spec.c (lang_specific_driver): Add -lstdc++ when compiling
index f24a2fe..b39f532 100644 (file)
@@ -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.  */
index 10c9487..cc6e940 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-02  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c++/28253
+       * g++.dg/inherit/covariant16.C: New test.
+
 2007-03-02  Geoffrey Keating  <geoffk@apple.com>
 
        * 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 (file)
index 0000000..828b5b8
--- /dev/null
@@ -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" } */
+};