public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix mangling of ABI-tagged std::wstring
@ 2014-11-14 12:14 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2014-11-14 12:14 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

Jason approved this yesterday on IRC.

Tested powerpc64-linux, committed to trunk.

[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1361 bytes --]

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) {}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-14 12:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 12:14 [patch] Fix mangling of ABI-tagged std::wstring Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).