]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix abi-tag17.C.
authorJason Merrill <jason@redhat.com>
Sun, 31 Jan 2016 11:52:48 +0000 (06:52 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 31 Jan 2016 11:52:48 +0000 (06:52 -0500)
* pt.c (lookup_template_class_1): Don't share TYPE_ATTRIBUTES
between template and instantiation.

From-SVN: r233017

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/abi/abi-tag17.C [new file with mode: 0644]

index 3b5c9d505128ba35ba5fbfccfd00e0f26bb2d4cf..b95610451df34c2b4c3ebf882d209dbbf7b118df 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-31  Jason Merrill  <jason@redhat.com>
+
+       * pt.c (lookup_template_class_1): Don't share TYPE_ATTRIBUTES
+       between template and instantiation.
+
 2016-01-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/66869
index 186a5d278b8975bd483391a386db7834702123a7..0d0e66497b13399cf934304cb451a8b056998aa4 100644 (file)
@@ -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 (file)
index 0000000..cb7dbab
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-final { scan-assembler "_Z3fi1B6_X_tagv" } }
+
+struct __attribute((abi_tag("_A1_tag"))) A1 {};
+template <class T> struct __attribute((abi_tag("_X_tag"))) X {};
+X<int> fi1();
+int main() {
+  X<A1> xa;
+  fi1();
+}