From: Kai Tietz Date: Thu, 19 Jan 2012 23:07:01 +0000 (+0100) Subject: Backmerged from trunk PR c++/51344 X-Git-Tag: releases/gcc-4.4.7~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af765cc21b0a82c4540600f6a6abded92a5f0654;p=thirdparty%2Fgcc.git Backmerged from trunk PR c++/51344 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: r183319 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7276a3f2d63f..74c04922edd1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2012-01-19 Kai Tietz + + PR c++/51344 + * decl2.c (save_template_attributes): Use merge_attributes + instead of chaining up via TREE_CHAIN. + 2011-10-19 Jason Merrill PR c++/50793 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7bfe77370112..744209e87ecc 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1152,9 +1152,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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 088b119e308c..16e3d730a314 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-01-19 Kai Tietz + + * g++.dg/torture/pr51344.C: New test. + 2012-01-15 Uros Bizjak 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 index 000000000000..482c0fae0651 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr51344.C @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +template +class B +{ + friend __attribute__((cdecl)) A& operator >>(A& a, B& b) + { + return a; + } +};