]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/12103 (-g only crash (segfault) with a forward declared class used as...
authorMark Mitchell <mark@codesourcery.com>
Sun, 29 Feb 2004 23:10:43 +0000 (23:10 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 29 Feb 2004 23:10:43 +0000 (23:10 +0000)
PR debug/12103
* class.c (update_vtable_entry_for_fn): Do not go through
covariance machinery if the type returned by an overrider is the
same as the original.

PR debug/12103
* g++.dg/debug/crash1.C: New test.

From-SVN: r78680

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

index 2c05b719ca158bfdeb931c6f3f553d7c8ae3eba0..979f578c0918c200985abdd04b551ecd58254257 100644 (file)
@@ -1,3 +1,10 @@
+2004-02-29  Mark Mitchell  <mark@codesourcery.com>
+
+       PR debug/12103
+       * class.c (update_vtable_entry_for_fn): Do not go through
+       covariance machinery if the type returned by an overrider is the
+       same as the original.
+
 2004-02-29  Kazu Hirata  <kazu@cs.umass.edu>
 
        * call.c: Fix a comment typo.
index f09368fcb2f7ee8bac0bcfdf69105b3b92eaf705..3a34ce45668d57231cc550113521da4cd9c46226 100644 (file)
@@ -2090,7 +2090,8 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
          TREE_VALUE (purpose_member
                      (BINFO_TYPE (virtual_offset),
                       CLASSTYPE_VBASECLASSES (TREE_TYPE (over_return))));
-      else
+      else if (!same_type_p (TREE_TYPE (over_return),
+                            TREE_TYPE (base_return)))
        {
          /* There was no existing virtual thunk (which takes
             precedence).  */
index 650c6fc8700b654ea6f8c9aafc9bb8ca12915474..b5aa29d32f2cd5098c5d86b60631152850623ec1 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-29  Mark Mitchell  <mark@codesourcery.com>
+
+       PR debug/12103
+       * g++.dg/debug/crash1.C: New test.
+
 2004-02-29  Kazu Hirata  <kazu@cs.umass.edu>
 
        * gcc.dg/sibcall-3.c (recurser_void1): Make it an extern
diff --git a/gcc/testsuite/g++.dg/debug/crash1.C b/gcc/testsuite/g++.dg/debug/crash1.C
new file mode 100644 (file)
index 0000000..4fba256
--- /dev/null
@@ -0,0 +1,17 @@
+template <typename T>
+class foo
+{
+  T t;
+};
+
+class bar;
+typedef foo<bar> foobar;
+
+class obj
+{
+  virtual foobar* yeah() = 0;
+};
+
+class bar : virtual public obj
+{
+};