From cbe4c88c5ef99e9ff26f9aef92b3cd68707d4d9c Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 14 Nov 2014 12:02:09 +0000 Subject: [PATCH] mangle.c (find_substitution): Look for abi_tag on class templates. gcc/cp: * mangle.c (find_substitution): Look for abi_tag on class templates. gcc/testsuite: * g++.dg/abi/abi-tag11.C: New. From-SVN: r217557 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/mangle.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/abi/abi-tag11.C | 12 ++++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/abi/abi-tag11.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 26aa986a2f3..ddef4ff68b2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-14 Jonathan Wakely + + * mangle.c (find_substitution): Look for abi_tag on class templates. + 2014-11-13 Bernd Schmidt Thomas Schwinge Ilya Verbin diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 048c957519b..576ad1d1978 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -609,7 +609,7 @@ find_substitution (tree node) } tree tags = NULL_TREE; - if (OVERLOAD_TYPE_P (node)) + if (OVERLOAD_TYPE_P (node) || DECL_CLASS_TEMPLATE_P (node)) tags = lookup_attribute ("abi_tag", TYPE_ATTRIBUTES (type)); /* Now check the list of available substitutions for this mangling operation. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b6a07d3fb12..c7d7a904dc0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-11-14 Jonathan Wakely + + * g++.dg/abi/abi-tag11.C: New. + 2014-11-14 Marek Polacek * c-c++-common/ubsan/overflow-negate-3.c: New test. diff --git a/gcc/testsuite/g++.dg/abi/abi-tag11.C b/gcc/testsuite/g++.dg/abi/abi-tag11.C new file mode 100644 index 00000000000..36c1c9f0c09 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag11.C @@ -0,0 +1,12 @@ +// { dg-final { scan-assembler "_Z1fSbB3fooIwSt11char_traitsIwESaIwEES3_" } } + +namespace std { + template struct char_traits {}; + template struct allocator {}; + template + struct __attribute ((abi_tag ("foo"))) basic_string { }; + typedef basic_string,allocator > + wstring; +} + +void f(std::wstring,std::wstring) {} -- 2.30.2