On 04/06/2016 12:22 PM, Jason Merrill wrote:
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.
Still not quite right... Tested x86_64-pc-linux-gnu, applying to trunk.
commit 6e6a82cf6bad124a9d97622a6f42968baf72ba2b Author: Jason Merrill <ja...@redhat.com> Date: Sat Apr 9 12:07:26 2016 -0400 * mangle.c (decl_is_template_id): The template itself counts as a template-id. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 5d38373..0e44409 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -264,9 +264,9 @@ static void write_java_integer_type_codes (const tree); #define write_unsigned_number(NUMBER) \ write_number ((NUMBER), /*unsigned_p=*/1, 10) -/* If DECL is a template instance, return nonzero and, if - TEMPLATE_INFO is non-NULL, set *TEMPLATE_INFO to its template info. - Otherwise return zero. */ +/* If DECL is a template instance (including the uninstantiated template + itself), return nonzero and, if TEMPLATE_INFO is non-NULL, set + *TEMPLATE_INFO to its template info. Otherwise return zero. */ static int decl_is_template_id (const tree decl, tree* const template_info) @@ -290,7 +290,8 @@ decl_is_template_id (const tree decl, tree* const template_info) { /* Check if this is a primary template. */ if (DECL_LANG_SPECIFIC (decl) != NULL - && DECL_USE_TEMPLATE (decl) + && VAR_OR_FUNCTION_DECL_P (decl) + && DECL_TEMPLATE_INFO (decl) && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl)) && TREE_CODE (decl) != TEMPLATE_DECL) { diff --git a/gcc/testsuite/g++.dg/abi/abi-tag20.C b/gcc/testsuite/g++.dg/abi/abi-tag20.C new file mode 100644 index 0000000..229c170 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag20.C @@ -0,0 +1,15 @@ +// { dg-do compile { target c++11 } } +// { dg-final { scan-assembler "_ZN1B1gIcEEN7__cxx111XEv" } } + +inline namespace __cxx11 __attribute__((__abi_tag__ ("ABI_TAG"))) { + class X {}; +} +struct B { + X f(); + template <class U> X g(); +}; +int main() { + B b; + b.g<char>(); + return 0; +}