This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix mangling of ABI-tagged std::wstring
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 14 Nov 2014 12:02:15 +0000
- Subject: [patch] Fix mangling of ABI-tagged std::wstring
- Authentication-results: sourceware.org; auth=none
Jason approved this yesterday on IRC.
Tested powerpc64-linux, committed to trunk.
commit 9a8efcc0e2068abb51aaf513b4a7ed262454cd1e
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Nov 14 11:00:24 2014 +0000
gcc/cp:
* mangle.c (find_substitution): Look for abi_tag on class templates.
gcc/testsuite:
* g++.dg/abi/abi-tag11.C: New.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 048c957..576ad1d 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/g++.dg/abi/abi-tag11.C b/gcc/testsuite/g++.dg/abi/abi-tag11.C
new file mode 100644
index 0000000..36c1c9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag11.C
@@ -0,0 +1,12 @@
+// { dg-final { scan-assembler "_Z1fSbB3fooIwSt11char_traitsIwESaIwEES3_" } }
+
+namespace std {
+ template <class T> struct char_traits {};
+ template <class T> struct allocator {};
+ template <class T, class U, class V>
+ struct __attribute ((abi_tag ("foo"))) basic_string { };
+ typedef basic_string<wchar_t,char_traits<wchar_t>,allocator<wchar_t> >
+ wstring;
+}
+
+void f(std::wstring,std::wstring) {}