OSDN Git Service

PR c++/51812
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Jan 2012 13:37:38 +0000 (13:37 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Jan 2012 13:37:38 +0000 (13:37 +0000)
* cgraphunit.c (cgraph_decide_is_function_needed): Don't always
output static aliases.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183475 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 05ec2e1..ebbb8d0 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
 2012-01-24  Jakub Jelinek  <jakub@redhat.com>
 
        PR driver/47249
index 6ea40ce..8f96d38 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
      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)
            && !DECL_DISREGARD_INLINE_LIMITS (decl)
            && !DECL_DECLARED_INLINE_P (decl)
            && !(DECL_CONTEXT (decl)
index 1db5388..b97bf39 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
 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() { }