aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-11-04 14:34:25 -0500
committerJason Merrill <jason@gcc.gnu.org>2009-11-04 14:34:25 -0500
commiteeeca7d418efdd5ff1260bb3baf611531bc47ee3 (patch)
tree6382f5828670101da8d8b250204a2cd5e0aa19f4
parentd87f43c3584a8c529e9ed443477473be579d3229 (diff)
downloadgcc-eeeca7d418efdd5ff1260bb3baf611531bc47ee3.zip
gcc-eeeca7d418efdd5ff1260bb3baf611531bc47ee3.tar.gz
gcc-eeeca7d418efdd5ff1260bb3baf611531bc47ee3.tar.bz2
re PR c++/15882 (Check for return type of overloaded operator new too early)
PR c++/15882 * method.c (use_thunk): Check DECL_WEAK as well as DECL_ONE_ONLY. From-SVN: r153909
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/method.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/abi/thunk5.C13
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1014832..484e510 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2009-11-04 Jason Merrill <jason@redhat.com>
+ PR c++/15882
+ * method.c (use_thunk): Check DECL_WEAK as well as
+ DECL_ONE_ONLY.
+
PR c++/17365, DR 218
* name-lookup.c (add_function): Ignore non-functions.
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 266406c..f13d99d 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -378,7 +378,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, cxx_comdat_group (thunk_fndecl));
if (flag_syntax_only)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a0e861b..86c9b11 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/15882
+ * g++.dg/abi/thunk5.C: New.
+
2009-11-04 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/41833
diff --git a/gcc/testsuite/g++.dg/abi/thunk5.C b/gcc/testsuite/g++.dg/abi/thunk5.C
new file mode 100644
index 0000000..623b9bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/thunk5.C
@@ -0,0 +1,13 @@
+// PR c++/15882
+// 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;