mangle.c (find_substitution): Look for abi_tag on class templates.
authorJonathan Wakely <jwakely@redhat.com>
Fri, 14 Nov 2014 12:02:09 +0000 (12:02 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 14 Nov 2014 12:02:09 +0000 (12:02 +0000)
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
gcc/cp/mangle.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/abi-tag11.C [new file with mode: 0644]

index 26aa986..ddef4ff 100644 (file)
@@ -1,3 +1,7 @@
+2014-11-14  Jonathan Wakely  <jwakely@redhat.com>
+
+       * mangle.c (find_substitution): Look for abi_tag on class templates.
+
 2014-11-13  Bernd Schmidt  <bernds@codesourcery.com>
            Thomas Schwinge  <thomas@codesourcery.com>
            Ilya Verbin  <ilya.verbin@intel.com>
index 048c957..576ad1d 100644 (file)
@@ -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.  */
index b6a07d3..c7d7a90 100644 (file)
@@ -1,3 +1,7 @@
+2014-11-14  Jonathan Wakely  <jwakely@redhat.com>
+
+       * g++.dg/abi/abi-tag11.C: New.
+
 2014-11-14  Marek Polacek  <polacek@redhat.com>
 
        * 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 (file)
index 0000000..36c1c9f
--- /dev/null
@@ -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) {}