]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/51344 (cc1plus hangs when compiling)
authorKai Tietz <ktietz@redhat.com>
Thu, 19 Jan 2012 22:34:29 +0000 (23:34 +0100)
committerKai Tietz <ktietz@gcc.gnu.org>
Thu, 19 Jan 2012 22:34:29 +0000 (23:34 +0100)
        Backport 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: r183315

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

index 473571de0ce5d6c6a4730df6c1ca9ea2a8075048..e1e00f5db4f4e2538373b3b9ea1d8560ba4f1ac3 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.
+
 2012-01-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/51854
index 91036020822182cadb82095b7630af8cb43e2e34..51f23f47c66a53d3a5a7e7c4a2365389ade09cc2 100644 (file)
@@ -1185,9 +1185,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 ed5d163766e31b3f07b1200a80eb314847ce846e..f084c8c74c8a0c6aa01f96627fb668debc59ca6b 100644 (file)
@@ -1,3 +1,7 @@
+2012-01-19  Kai Tietz  <ktietz@redhat.com>
+
+       * g++.dg/torture/pr51344.C: New test.
+
 2012-01-19  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/51904
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;
+  }
+};