]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backmerged from trunk PR c++/51344
authorKai Tietz <ktietz@redhat.com>
Thu, 19 Jan 2012 22:57:31 +0000 (23:57 +0100)
committerKai Tietz <ktietz@gcc.gnu.org>
Thu, 19 Jan 2012 22:57:31 +0000 (23:57 +0100)
        Backmerged from trunk
        PR c++/51344
        * decl2.c (save_template_attributes): Use merge_attributes
        instead of chaining up via TREE_CHAIN.

        * g++.dg/torture/pr51344.C: New test.

From-SVN: r183318

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr51344.C [new file with mode: 0644]

index 7cdca29fd2c08f6576ba362fb65884187873bf9f..87ac40ac9d70e19f2fbd4d97f3b8e6ea75b92f15 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-19  Kai Tietz  <ktietz@redhat.com>
+
+       PR c++/51344
+       * decl2.c (save_template_attributes): Use merge_attributes
+       instead of chaining up via TREE_CHAIN.
+
 2011-12-20  Dodji Seketeli  <dodji@redhat.com>
 
        PR debug/49951
index 6c33434eb8dba9b329b56db8a3283c47b1fb8fa6..8b29b42cc0f218001d0d2ec2d99b6c6df477ecf0 100644 (file)
@@ -1189,9 +1189,9 @@ save_template_attributes (tree *attr_p, tree *decl_p)
 
   old_attrs = *q;
 
-  /* Place the late attributes at the beginning of the attribute
+  /* Merge the late attributes at the beginning with the attribute
      list.  */
-  TREE_CHAIN (tree_last (late_attrs)) = *q;
+  late_attrs = merge_attributes (late_attrs, *q);
   *q = late_attrs;
 
   if (!DECL_P (*decl_p) && *decl_p == TYPE_MAIN_VARIANT (*decl_p))
index 68a7f9e85fdf538ad3d3523037a80b083f5c01f5..b5ab9ac6d8c6e881f73f9fae67bf246a4c9926a9 100644 (file)
@@ -1,3 +1,7 @@
+2012-01-19  Kai Tietz  <ktietz@redhat.com>
+
+       * g++.dg/torture/pr51344.C: New test.
+
 2012-01-15  Uros Bizjak  <ubizjak@gmail.com>
 
        PR rtl-optimization/51821
diff --git a/gcc/testsuite/g++.dg/torture/pr51344.C b/gcc/testsuite/g++.dg/torture/pr51344.C
new file mode 100644 (file)
index 0000000..482c0fa
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+template <class T>
+class B
+{
+  friend __attribute__((cdecl)) A& operator >>(A& a, B& b)
+  {
+    return a;
+  }
+};