We were incorrectly omitting the ABI tag on the instantiation of this member function because we were setting the tags on the instantiation and looking for them on the temploid.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 32a5b18940f37dd97c2735f24a8353d1db457d86
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Apr 6 07:45:02 2016 -0400

    	* class.c (check_abi_tags): Fix function template handling.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 937e41f..02a992f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1604,6 +1604,15 @@ check_abi_tags (tree t, tree subob)
 void
 check_abi_tags (tree decl)
 {
+  tree t;
+  if (abi_version_at_least (10)
+      && DECL_LANG_SPECIFIC (decl)
+      && DECL_USE_TEMPLATE (decl)
+      && (t = DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (decl)),
+	  t != decl))
+    /* Make sure that our template has the appropriate tags, since
+       write_unqualified_name looks for them there.  */
+    check_abi_tags (t);
   if (VAR_P (decl))
     check_abi_tags (decl, TREE_TYPE (decl));
   else if (TREE_CODE (decl) == FUNCTION_DECL
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag19.C b/gcc/testsuite/g++.dg/abi/abi-tag19.C
new file mode 100644
index 0000000..e21d7b1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag19.C
@@ -0,0 +1,4 @@
+struct __attribute__((abi_tag("a"))) X { };
+template<typename T> struct Y { X f() { return X(); } };
+template struct Y<int>;
+// { dg-final { scan-assembler "_ZN1YIiE1fB1aEv" } }

Reply via email to