From b676a0798f55af50365f0cee6351ac7c959bf3d8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 31 Jan 2016 06:52:48 -0500 Subject: [PATCH] Fix abi-tag17.C. * pt.c (lookup_template_class_1): Don't share TYPE_ATTRIBUTES between template and instantiation. From-SVN: r233017 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 6 +----- gcc/testsuite/g++.dg/abi/abi-tag17.C | 9 +++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/abi/abi-tag17.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3b5c9d50512..b95610451df 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-01-31 Jason Merrill + + * pt.c (lookup_template_class_1): Don't share TYPE_ATTRIBUTES + between template and instantiation. + 2016-01-29 Jakub Jelinek PR debug/66869 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 186a5d278b8..0d0e66497b1 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8482,11 +8482,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, tree attributes = lookup_attribute (tags[ix], TYPE_ATTRIBUTES (template_type)); - if (!attributes) - ; - else if (!TREE_CHAIN (attributes) && !TYPE_ATTRIBUTES (t)) - TYPE_ATTRIBUTES (t) = attributes; - else + if (attributes) TYPE_ATTRIBUTES (t) = tree_cons (TREE_PURPOSE (attributes), TREE_VALUE (attributes), diff --git a/gcc/testsuite/g++.dg/abi/abi-tag17.C b/gcc/testsuite/g++.dg/abi/abi-tag17.C new file mode 100644 index 00000000000..cb7dbab9c7f --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag17.C @@ -0,0 +1,9 @@ +// { dg-final { scan-assembler "_Z3fi1B6_X_tagv" } } + +struct __attribute((abi_tag("_A1_tag"))) A1 {}; +template struct __attribute((abi_tag("_X_tag"))) X {}; +X fi1(); +int main() { + X xa; + fi1(); +} -- 2.30.2