re PR c++/28253 (ICE with invalid covariant return)
authorSimon Martin <simartin@users.sourceforge.net>
Fri, 2 Mar 2007 22:09:20 +0000 (22:09 +0000)
committerSimon Martin <simartin@gcc.gnu.org>
Fri, 2 Mar 2007 22:09:20 +0000 (22:09 +0000)
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.

From-SVN: r122490

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

index a45c8661b5196824e39af80e06211b31aac9437b..3319d7bb74b4e76acd56db7828822f8e9b6d9daa 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 f24a2fec32788be208cbbd074616d9a05691027e..b39f532668661b04223a1ec50c44911753145d07 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 10c948793f38afac6cd3907c8102cdec9d949af2..cc6e940c5ca20c081a05c79e3093200f11cbece2 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" } */
+};