]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/35067 (multiple definition of virtual thunk)
authorJason Merrill <jason@redhat.com>
Wed, 4 Nov 2009 20:08:44 +0000 (15:08 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 4 Nov 2009 20:08:44 +0000 (15:08 -0500)
PR c++/35067
* method.c (use_thunk): Check DECL_WEAK as well as
DECL_ONE_ONLY.

From-SVN: r153913

gcc/cp/ChangeLog
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/thunk5.C [new file with mode: 0644]

index 3fb5d3f5d6e23322140cbf198d25f620b440b1d9..7477e82161d027f6a9cf597b8dae3eac215e30b9 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/35067
+       * method.c (use_thunk): Check DECL_WEAK as well as
+       DECL_ONE_ONLY.
+
 2009-11-04  Dodji Seketeli  <dodji@redhat.com>
 
        Revert fix for PR c++/37093
index 3ef73fb8d0479b8b3231c2efd46f8e14ffc27b1c..c91fc4766ff316398ca402fe169a464321b058e2 100644 (file)
@@ -381,7 +381,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
   DECL_VISIBILITY (thunk_fndecl) = DECL_VISIBILITY (function);
   DECL_VISIBILITY_SPECIFIED (thunk_fndecl)
     = DECL_VISIBILITY_SPECIFIED (function);
-  if (DECL_ONE_ONLY (function))
+  if (DECL_ONE_ONLY (function) || DECL_WEAK (function))
     make_decl_one_only (thunk_fndecl);
 
   if (flag_syntax_only)
index fcdd3edcdf077c03c4ccfefa1688c30b50b05ab5..130a5bcabffb838d4f9ac5493dd3419ffbf75366 100644 (file)
@@ -1,3 +1,8 @@
+2009-11-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/35067
+       * g++.dg/abi/thunk5.C: New.
+
 2009-11-04  Dodji Seketeli  <dodji@redhat.com>
 
        Revert fix for PR c++/37093
diff --git a/gcc/testsuite/g++.dg/abi/thunk5.C b/gcc/testsuite/g++.dg/abi/thunk5.C
new file mode 100644 (file)
index 0000000..15526bf
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/35067
+// The thunks should be weak even on targets without one-only support.
+// { dg-require-weak "" }
+// { dg-final { scan-assembler "weak.*ZTv" } }
+
+struct A
+{
+  virtual ~A() { }
+};
+
+struct B: virtual A { };
+
+B b;