* cgraphunit.c (cgraph_function_versioning): Clear also DECL_VIRTUAL_P
on the copied decl.
* g++.dg/opt/thunk3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143973
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-02-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/39106
+ * cgraphunit.c (cgraph_function_versioning): Clear also DECL_VIRTUAL_P
+ on the copied decl.
+
2009-02-05 Paolo Bonzini <bonzini@gnu.org>
PR rtl-optimization/39110
TREE_PUBLIC (new_version_node->decl) = 0;
DECL_COMDAT (new_version_node->decl) = 0;
DECL_WEAK (new_version_node->decl) = 0;
+ DECL_VIRTUAL_P (new_version_node->decl) = 0;
new_version_node->local.externally_visible = 0;
new_version_node->local.local = 1;
new_version_node->lowered = true;
-
+
/* Update the call_expr on the edges to call the new version node. */
update_call_expr (new_version_node);
+2009-02-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/39106
+ * g++.dg/opt/thunk3.C: New test.
+
2009-02-05 Nick Clifton <nickc@redhat.com>
* gcc.c-torture/compile/20080625-1.c: Skip for M32C.
--- /dev/null
+// PR c++/39106
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+struct A
+{
+ A (bool x = true);
+};
+class B
+{
+ virtual bool bar (A &, int) const =0;
+};
+class C : virtual public B
+{
+};
+struct D : virtual public B
+{
+ bool bar (A &, int) const;
+};
+template <int N>
+struct E : public D
+{
+ bool bar (A &x, int y) const
+ {
+ return baz().bar (x, y);
+ }
+ const D & baz () const;
+};
+extern template class E<0>;
+
+void
+foo ()
+{
+ try
+ {
+ A a;
+ abort ();
+ } catch (...)
+ {
+ }
+ A b;
+ E<0> c;
+ c.bar (b, 3);
+ E<0> d;
+ d.bar (b, 3);
+}