]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add C++11 std::string constructors for locales and facets.
authorJonathan Wakely <jwakely@redhat.com>
Tue, 20 Jan 2015 11:50:51 +0000 (11:50 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 20 Jan 2015 11:50:51 +0000 (11:50 +0000)
* config/abi/pre/gnu.ver: Export new constructors.
* include/bits/codecvt.h (codecvt_byname): Add string constructor.
(codecvt_byname<char16_t>, codecvt_byname<char32_t>): Define explicit
specializations and declare explicit instantiations.
* include/bits/locale_classes.h (locale, collate_byname): Add string
constructors.
* include/bits/locale_facets.h (ctype_byname, numpunct_byname):
Likewise.
* include/bits/locale_facets_nonio.h (time_get_byname,
time_put_byname, moneypunct_byname, messages_byname): Likewise.
* src/c++11/codecvt.cc (codecvt_byname<char16_t>,
codecvt_byname<char32_t>): Define explicit instantiations.
* src/c++11/locale-inst.cc (time_put_byname, codecvt_byname):
Instantiate string constructors.
(ctype_byname): Define string constructor.
* testsuite/22_locale/codecvt_byname/1.cc: New.
* testsuite/22_locale/collate_byname/1.cc: New.
* testsuite/22_locale/ctype_byname/2.cc: New.
* testsuite/22_locale/messages_byname/1.cc: New.
* testsuite/22_locale/moneypunct_byname/1.cc: New.
* testsuite/22_locale/numpunct_byname/1.cc: New.

From-SVN: r219887

14 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/include/bits/codecvt.h
libstdc++-v3/include/bits/locale_classes.h
libstdc++-v3/include/bits/locale_facets.h
libstdc++-v3/include/bits/locale_facets_nonio.h
libstdc++-v3/src/c++11/codecvt.cc
libstdc++-v3/src/c++11/locale-inst.cc
libstdc++-v3/testsuite/22_locale/codecvt_byname/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/22_locale/collate_byname/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/22_locale/ctype_byname/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/22_locale/messages_byname/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc [new file with mode: 0644]

index 92e51f04856cd6677ec5e3c91f5c9f3b0421caf8..7410bbccfe0e26d1bceb05de5fbf0fd86a8d8598 100644 (file)
@@ -1,3 +1,27 @@
+2015-01-20  Jonathan Wakely  <jwakely@redhat.com>
+
+       * config/abi/pre/gnu.ver: Export new constructors.
+       * include/bits/codecvt.h (codecvt_byname): Add string constructor.
+       (codecvt_byname<char16_t>, codecvt_byname<char32_t>): Define explicit
+       specializations and declare explicit instantiations.
+       * include/bits/locale_classes.h (locale, collate_byname): Add string
+       constructors.
+       * include/bits/locale_facets.h (ctype_byname, numpunct_byname):
+       Likewise.
+       * include/bits/locale_facets_nonio.h (time_get_byname,
+       time_put_byname, moneypunct_byname, messages_byname): Likewise.
+       * src/c++11/codecvt.cc (codecvt_byname<char16_t>,
+       codecvt_byname<char32_t>): Define explicit instantiations.
+       * src/c++11/locale-inst.cc (time_put_byname, codecvt_byname):
+       Instantiate string constructors.
+       (ctype_byname): Define string constructor.
+       * testsuite/22_locale/codecvt_byname/1.cc: New.
+       * testsuite/22_locale/collate_byname/1.cc: New.
+       * testsuite/22_locale/ctype_byname/2.cc: New.
+       * testsuite/22_locale/messages_byname/1.cc: New.
+       * testsuite/22_locale/moneypunct_byname/1.cc: New.
+       * testsuite/22_locale/numpunct_byname/1.cc: New.
+
 2015-01-20  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/64658
index d23306e7c76f7ef9935e7412356faeebee386f92..61024bd7c0429568f3fa9a6e1f9e16444237ea6c 100644 (file)
@@ -64,8 +64,10 @@ GLIBCXX_3.4 {
 #     std::char_traits;
 #     std::c[i-z]*;
       std::c[i-n]*;
+#     std::collate;
+#     std::collate_byname;
 #     std::condition_variable;
-      std::co[^n]*;
+      std::co[^ln]*;
       std::c[p-s]*;
       std::cu[^r]*;
 #     std::current_exception
@@ -527,6 +529,14 @@ GLIBCXX_3.4 {
     # std::use_facet
     _ZSt9use_facetIS*;
 
+    # std::collate
+    _ZNSt7collateI[cw]*;
+    _ZNKSt7collateI[cw]*;
+
+    # std::collate_byname
+    _ZNSt14collate_bynameI[cw]EC[12]EPKc?*;
+    _ZNSt14collate_bynameI[cw]ED*;
+
     # std::ctype
     _ZNKSt5ctypeIcE8*;
     _ZNKSt5ctypeIcE9*;
@@ -538,7 +548,8 @@ GLIBCXX_3.4 {
     _ZNSt10ctype_base[56][ac-z]*;
 
     # std::ctype_byname
-    _ZNSt12ctype_bynameI[cw]*;
+    _ZNSt12ctype_bynameI[cw]EC[12]EPKc?*;
+    _ZNSt12ctype_bynameI[cw]ED*;
 
     # std::num_get
     _ZNKSt7num_getI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEE[2-9]*;
@@ -573,7 +584,8 @@ GLIBCXX_3.4 {
     _ZNKSt8time_put*;
 
     # std::time_put_byname
-    _ZNSt15time_put_byname*;
+    _ZNSt15time_put_bynameI[cw]*EC[12]EPKc?*;
+    _ZNSt15time_put_bynameI[cw]*ED[012]Ev;
 
     # std::numeric_limits
     _ZNSt21__numeric_limits_base[5-9]*;
@@ -1780,6 +1792,25 @@ GLIBCXX_3.4.21 {
     _ZNSt25__codecvt_utf8_utf16_base*;
     _ZT[ISV]St25__codecvt_utf8_utf16_base*;
 
+    # new string ctors for _byname facets
+    _ZNSt12ctype_bynameI[cw]EC[1-5]ERKSsm;
+    _ZNSt14codecvt_bynameI[cw]c11__mbstate_tEC[1-5]ERKSsm;
+    _ZNSt15messages_bynameI[cw]EC[1-5]ERKSsm;
+    _ZNSt15numpunct_bynameI[cw]EC[1-5]ERKSsm;
+    _ZNSt15time_get_bynameI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEEC[1-5]ERKSsm;
+    _ZNSt15time_put_bynameI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEEC[1-5]ERKSsm;
+    _ZNSt17moneypunct_bynameI[cw]Lb0EEC[1-5]ERKSsm;
+    _ZNSt17moneypunct_bynameI[cw]Lb1EEC[1-5]ERKSsm;
+
+    _ZNSt12ctype_bynameI[cw]EC[1-5]ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm;
+    _ZNSt14codecvt_bynameI[cw]c11__mbstate_tEC[1-5]ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm;
+    _ZNSt15time_put_bynameI[cw]St19ostreambuf_iteratorI[cw]St11char_traitsI[cw]EEEC[1-5]ERKNSt7__cxx1112basic_stringIcS2_SaIcEEEm;
+    _ZNSt7__cxx1115messages_bynameI[cw]EC[1-5]ERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEm;
+    _ZNSt7__cxx1115numpunct_bynameI[cw]EC[1-5]ERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEm;
+    _ZNSt7__cxx1115time_get_bynameI[cw]St19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEEC[1-5]ERKNS_12basic_stringIcS3_SaIcEEEm;
+    _ZNSt7__cxx1117moneypunct_bynameI[cw]Lb0EEC[1-5]ERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEm;
+    _ZNSt7__cxx1117moneypunct_bynameI[cw]Lb1EEC[1-5]ERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEm;
+
 } GLIBCXX_3.4.20;
 
 
index a6e59b5128f9595c8f2228387988a1b496206df1..c76215f87f54a0d8834d43401cffddd0d008ec66 100644 (file)
@@ -594,11 +594,55 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          }
       }
 
+#if __cplusplus >= 201103L
+      explicit
+      codecvt_byname(const string& __s, size_t __refs = 0)
+      : codecvt_byname(__s.c_str(), __refs) { }
+#endif
+
+    protected:
+      virtual
+      ~codecvt_byname() { }
+    };
+
+#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+  template<>
+    class codecvt_byname<char16_t, char, mbstate_t>
+    : public codecvt<char16_t, char, mbstate_t>
+    {
+    public:
+      explicit
+      codecvt_byname(const char* __s, size_t __refs = 0)
+      : codecvt<char16_t, char, mbstate_t>(__refs) { }
+
+      explicit
+      codecvt_byname(const string& __s, size_t __refs = 0)
+      : codecvt_byname(__s.c_str(), __refs) { }
+
     protected:
       virtual
       ~codecvt_byname() { }
     };
 
+  template<>
+    class codecvt_byname<char32_t, char, mbstate_t>
+    : public codecvt<char32_t, char, mbstate_t>
+    {
+    public:
+      explicit
+      codecvt_byname(const char* __s, size_t __refs = 0)
+      : codecvt<char32_t, char, mbstate_t>(__refs) { }
+
+      explicit
+      codecvt_byname(const string& __s, size_t __refs = 0)
+      : codecvt_byname(__s.c_str(), __refs) { }
+
+    protected:
+      virtual
+      ~codecvt_byname() { }
+    };
+#endif
+
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.
 #if _GLIBCXX_EXTERN_TEMPLATE
@@ -623,6 +667,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     bool
     has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
 #endif
+
+#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+  extern template class codecvt_byname<char16_t, char, mbstate_t>;
+  extern template class codecvt_byname<char32_t, char, mbstate_t>;
+#endif
+
 #endif
 
 _GLIBCXX_END_NAMESPACE_VERSION
index f591437f148a8b7e26c87be053d3527a0f2a6530..f3898ebf7b2ef40c4da245a3e46dca11eb18eec1 100644 (file)
@@ -150,6 +150,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     */
     locale(const locale& __base, const char* __s, category __cat);
 
+#if __cplusplus >= 201103L
+    /**
+     *  @brief  Named locale constructor.
+     *
+     *  Constructs a copy of the named C library locale.
+     *
+     *  @param  __s  Name of the locale to construct.
+     *  @throw  std::runtime_error if __s is an undefined locale.
+    */
+    explicit
+    locale(const std::string& __s) : locale(__s.c_str()) { }
+
+    /**
+     *  @brief  Construct locale with facets from another locale.
+     *
+     *  Constructs a copy of the locale @a base.  The facets specified by @a
+     *  cat are replaced with those from the locale named by @a s.  If base is
+     *  named, this locale instance will also be named.
+     *
+     *  @param  __base  The locale to copy.
+     *  @param  __s  Name of the locale to use facets from.
+     *  @param  __cat  Set of categories defining the facets to use from __s.
+     *  @throw  std::runtime_error if __s is an undefined locale.
+    */
+    locale(const locale& __base, const std::string& __s, category __cat)
+    : locale(__base, __s.c_str(), __cat) { }
+#endif
+
     /**
      *  @brief  Construct locale with facets from another locale.
      *
@@ -797,6 +825,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          }
       }
 
+#if __cplusplus >= 201103L
+      explicit
+      collate_byname(const string& __s, size_t __refs = 0)
+      : collate_byname(__s.c_str(), __refs) { }
+#endif
+
     protected:
       virtual
       ~collate_byname() { }
index 77932a5060b71018897aeabd43f86c9e0fcac0ed..0226b497c30df48cd4c46d62eb04f62d34b80aaf 100644 (file)
@@ -1479,6 +1479,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       explicit
       ctype_byname(const char* __s, size_t __refs = 0);
 
+#if __cplusplus >= 201103L
+      explicit
+      ctype_byname(const string& __s, size_t __refs = 0)
+      : ctype_byname(__s.c_str(), __refs) { }
+#endif
+
     protected:
       virtual
       ~ctype_byname() { };
@@ -1492,6 +1498,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       explicit
       ctype_byname(const char* __s, size_t __refs = 0);
 
+#if __cplusplus >= 201103L
+      explicit
+      ctype_byname(const string& __s, size_t __refs = 0);
+#endif
+
     protected:
       virtual
       ~ctype_byname();
@@ -1505,6 +1516,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       explicit
       ctype_byname(const char* __s, size_t __refs = 0);
 
+#if __cplusplus >= 201103L
+      explicit
+      ctype_byname(const string& __s, size_t __refs = 0);
+#endif
+
     protected:
       virtual
       ~ctype_byname();
@@ -1900,6 +1916,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
          }
       }
 
+#if __cplusplus >= 201103L
+      explicit
+      numpunct_byname(const string& __s, size_t __refs = 0)
+      : numpunct_byname(__s.c_str(), __refs) { }
+#endif
+
     protected:
       virtual
       ~numpunct_byname() { }
index 0c49880b0d3093d0cb92eb19ce357a12d4d74078..7eae6c80653fd6c57d3e7f7ee0b592cb7aee4e6f 100644 (file)
@@ -766,6 +766,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       time_get_byname(const char*, size_t __refs = 0)
       : time_get<_CharT, _InIter>(__refs) { }
 
+#if __cplusplus >= 201103L
+      explicit
+      time_get_byname(const string& __s, size_t __refs = 0)
+      : time_get_byname(__s.c_str(), __refs) { }
+#endif
+
     protected:
       virtual
       ~time_get_byname() { }
@@ -894,6 +900,12 @@ _GLIBCXX_END_NAMESPACE_CXX11
       : time_put<_CharT, _OutIter>(__refs)
       { };
 
+#if __cplusplus >= 201103L
+      explicit
+      time_put_byname(const string& __s, size_t __refs = 0)
+      : time_put_byname(__s.c_str(), __refs) { }
+#endif
+
     protected:
       virtual
       ~time_put_byname() { }
@@ -1419,6 +1431,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
          }
       }
 
+#if __cplusplus >= 201103L
+      explicit
+      moneypunct_byname(const string& __s, size_t __refs = 0)
+      : moneypunct_byname(__s.c_str(), __refs) { }
+#endif
+
     protected:
       virtual
       ~moneypunct_byname() { }
@@ -1969,6 +1987,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       explicit
       messages_byname(const char* __s, size_t __refs = 0);
 
+#if __cplusplus >= 201103L
+      explicit
+      messages_byname(const string& __s, size_t __refs = 0)
+      : messages_byname(__s.c_str(), __refs) { }
+#endif
+
     protected:
       virtual
       ~messages_byname()
index 7eed903bc0cdcecb2c0067fd448e309c84eed438..594dae6810c9aff15b85086f903adefa827587fe 100644 (file)
@@ -1402,6 +1402,8 @@ __codecvt_utf8_utf16_base<wchar_t>::do_max_length() const throw()
 
 inline template class __codecvt_abstract_base<char16_t, char, mbstate_t>;
 inline template class __codecvt_abstract_base<char32_t, char, mbstate_t>;
+template class codecvt_byname<char16_t, char, mbstate_t>;
+template class codecvt_byname<char32_t, char, mbstate_t>;
 
 _GLIBCXX_END_NAMESPACE_VERSION
 }
index 573da4d433ee21e4e605dde3dfd15c5357bd068f..9240b407f158e8f6dae546c21b217cf674e0bb7e 100644 (file)
@@ -192,6 +192,9 @@ _GLIBCXX_END_NAMESPACE_LDBL
   template struct __timepunct_cache<C>;
   template class time_put<C, ostreambuf_iterator<C> >;
   template class time_put_byname<C, ostreambuf_iterator<C> >;
+#else
+  // Instantiate constructor taking __cxx11::string
+  template time_put_byname<C>::time_put_byname(const string&, size_t);
 #endif
 _GLIBCXX_BEGIN_NAMESPACE_CXX11
   template class time_get<C, istreambuf_iterator<C> >;
@@ -205,6 +208,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 _GLIBCXX_END_NAMESPACE_CXX11
   
   // ctype
+  ctype_byname<C>::ctype_byname(const string& __s, size_t __refs)
+  : ctype_byname(__s.c_str(), __refs) { }
+
 #if ! _GLIBCXX_USE_CXX11_ABI
   inline template class __ctype_abstract_base<C>;
   template class ctype_byname<C>;
@@ -214,6 +220,9 @@ _GLIBCXX_END_NAMESPACE_CXX11
 #if ! _GLIBCXX_USE_CXX11_ABI
   inline template class __codecvt_abstract_base<C, char, mbstate_t>;
   template class codecvt_byname<C, char, mbstate_t>;
+#else
+  // Instantiate constructor taking __cxx11::string
+  template codecvt_byname<C, char, mbstate_t>::codecvt_byname(const string&, size_t);
 #endif
 
   // collate
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt_byname/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt_byname/1.cc
new file mode 100644 (file)
index 0000000..8609b80
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do link }
+
+#include <locale>
+#include <string>
+
+std::string s = "C";
+
+template<typename C>
+struct facet : std::codecvt_byname<C, char, std::mbstate_t>
+{
+  facet() : std::codecvt_byname<C, char, std::mbstate_t>(s) { }
+};
+
+void
+test01()
+{
+  facet<char> c;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  facet<wchar_t> w;
+#endif
+}
+
+int
+main()
+{
+  test01();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc b/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc
new file mode 100644 (file)
index 0000000..73b24db
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do link }
+
+#include <locale>
+#include <string>
+
+std::string s = "C";
+
+template<typename C>
+struct facet : std::collate_byname<C>
+{
+  facet() : std::collate_byname<C>(s) { }
+};
+
+void
+test01()
+{
+  facet<char> c;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  facet<wchar_t> w;
+#endif
+}
+
+int
+main()
+{
+  test01();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/ctype_byname/2.cc b/libstdc++-v3/testsuite/22_locale/ctype_byname/2.cc
new file mode 100644 (file)
index 0000000..f005384
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do link }
+
+#include <locale>
+#include <string>
+
+std::string s = "C";
+
+template<typename C>
+struct facet : std::ctype_byname<C>
+{
+  facet() : std::ctype_byname<C>(s) { }
+};
+
+void
+test01()
+{
+  facet<char> c;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  facet<wchar_t> w;
+#endif
+}
+
+int
+main()
+{
+  test01();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc b/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc
new file mode 100644 (file)
index 0000000..5902a92
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do link }
+
+#include <locale>
+#include <string>
+
+std::string s = "C";
+
+template<typename C>
+struct facet : std::messages_byname<C>
+{
+  facet() : std::messages_byname<C>(s) { }
+};
+
+void
+test01()
+{
+  facet<char> c;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  facet<wchar_t> w;
+#endif
+}
+
+int
+main()
+{
+  test01();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc b/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc
new file mode 100644 (file)
index 0000000..a9bf44c
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do link }
+
+#include <locale>
+#include <string>
+
+std::string s = "C";
+
+template<typename C, bool I>
+struct facet : std::moneypunct_byname<C, I>
+{
+  facet() : std::moneypunct_byname<C, I>(s) { }
+};
+
+void
+test01()
+{
+  facet<char, false> c0;
+  facet<char, true> c1;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  facet<wchar_t, false> w0;
+  facet<wchar_t, true> w1;
+#endif
+}
+
+int
+main()
+{
+  test01();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc b/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc
new file mode 100644 (file)
index 0000000..2fca03f
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-do link }
+
+#include <locale>
+#include <string>
+
+std::string s = "C";
+
+template<typename C>
+struct facet : std::numpunct_byname<C>
+{
+  facet() : std::numpunct_byname<C>(s) { }
+};
+
+void
+test01()
+{
+  facet<char> c;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  facet<wchar_t> w;
+#endif
+}
+
+int
+main()
+{
+  test01();
+}