re PR c++/51812 (Virtual public inheritance and thunks leads to "undefined reference...
authorJason Merrill <jason@redhat.com>
Tue, 24 Jan 2012 13:37:38 +0000 (08:37 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 24 Jan 2012 13:37:38 +0000 (08:37 -0500)
PR c++/51812
* cgraphunit.c (cgraph_decide_is_function_needed): Don't always
output static aliases.

From-SVN: r183475

gcc/ChangeLog
gcc/cgraphunit.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/covariant20.C [new file with mode: 0644]

index 05ec2e139b040eba09384b72e9111fe1f6cfbe3b..ebbb8d04dffa2d4969d59dde994c409bc90fd739 100644 (file)
@@ -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
index 6ea40ce4e52eb773d9121734dc136a298393cf65..8f96d3859bf441f5f793a3bbde24ab63cd30b1d3 100644 (file)
@@ -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)
index 1db5388c3190d741a08d7880a9bf04a333aa8c36..b97bf39b3538f10b07d85badafab363f0eb31f35 100644 (file)
@@ -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 (file)
index 0000000..cf7e196
--- /dev/null
@@ -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() { }