aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-01-24 08:37:38 -0500
committerJason Merrill <jason@gcc.gnu.org>2012-01-24 08:37:38 -0500
commitc5c90089e6f24e5c3d31a1e70edbe1bbe14a2a61 (patch)
treeddc7240274c757115a71e345f5233558b9f35979
parent5460e1fc15f7f0bab22b39e76ae736ca43b7e654 (diff)
downloadgcc-c5c90089e6f24e5c3d31a1e70edbe1bbe14a2a61.zip
gcc-c5c90089e6f24e5c3d31a1e70edbe1bbe14a2a61.tar.gz
gcc-c5c90089e6f24e5c3d31a1e70edbe1bbe14a2a61.tar.bz2
re PR c++/51812 (Virtual public inheritance and thunks leads to "undefined reference" in header files.)
PR c++/51812 * cgraphunit.c (cgraph_decide_is_function_needed): Don't always output static aliases. From-SVN: r183475
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cgraphunit.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/inherit/covariant20.C10
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 05ec2e1..ebbb8d0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/51812
+ * cgraphunit.c (cgraph_decide_is_function_needed): Don't always
+ output static aliases.
+
2012-01-24 Jakub Jelinek <jakub@redhat.com>
PR driver/47249
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 6ea40ce..8f96d38 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -195,6 +195,7 @@ cgraph_decide_is_function_needed (struct cgraph_node *node, tree decl)
to change the behavior here. */
if (((TREE_PUBLIC (decl)
|| (!optimize
+ && !node->same_body_alias
&& !DECL_DISREGARD_INLINE_LIMITS (decl)
&& !DECL_DECLARED_INLINE_P (decl)
&& !(DECL_CONTEXT (decl)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1db5388..b97bf39 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/51812
+ * g++.dg/inherit/covariant20.C: New.
+
2012-01-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51223
diff --git a/gcc/testsuite/g++.dg/inherit/covariant20.C b/gcc/testsuite/g++.dg/inherit/covariant20.C
new file mode 100644
index 0000000..cf7e196
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/covariant20.C
@@ -0,0 +1,10 @@
+// PR c++/51812
+// { dg-do link }
+
+class Object {
+ virtual Object* clone() const;
+};
+class DNA: virtual public Object {
+ virtual DNA* clone() const {return new DNA(*this);}
+};
+int main() { }