On 16/01/15 23:38 +0000, Jonathan Wakely wrote:
This defines the C++11 header <codecvt> and adds the wstring_convert and wbuffer_convert utilities.
I've discovered that wasn't the last piece of the C++11 library, there were new constructors taking std::string added to std::locale and all the std::xxx_byname facets. It would be fixed by the attached patch (tested on x86_64-linux with old and new std::string), but we're in stage4 now so I'm not committing it yet.
commit 977b94ddcf8218efa0318f69b3a2cc5b5d9eb5be Author: Jonathan Wakely <jwak...@redhat.com> Date: Sun Jan 18 16:41:28 2015 +0000 Add C++11 std::string constructors for locales and facets. * 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. diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index d23306e..61024bd 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -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; diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h index a6e59b5..c76215f 100644 --- a/libstdc++-v3/include/bits/codecvt.h +++ b/libstdc++-v3/include/bits/codecvt.h @@ -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 diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h index f591437..f3898eb 100644 --- a/libstdc++-v3/include/bits/locale_classes.h +++ b/libstdc++-v3/include/bits/locale_classes.h @@ -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() { } diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 77932a5..0226b49 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -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() { } diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.h b/libstdc++-v3/include/bits/locale_facets_nonio.h index 0c49880..7eae6c8 100644 --- a/libstdc++-v3/include/bits/locale_facets_nonio.h +++ b/libstdc++-v3/include/bits/locale_facets_nonio.h @@ -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() diff --git a/libstdc++-v3/src/c++11/codecvt.cc b/libstdc++-v3/src/c++11/codecvt.cc index 7eed903..594dae6 100644 --- a/libstdc++-v3/src/c++11/codecvt.cc +++ b/libstdc++-v3/src/c++11/codecvt.cc @@ -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 } diff --git a/libstdc++-v3/src/c++11/locale-inst.cc b/libstdc++-v3/src/c++11/locale-inst.cc index 573da4d..9240b40 100644 --- a/libstdc++-v3/src/c++11/locale-inst.cc +++ b/libstdc++-v3/src/c++11/locale-inst.cc @@ -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 index 0000000..8609b80 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/codecvt_byname/1.cc @@ -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 index 0000000..73b24db --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/collate_byname/1.cc @@ -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 index 0000000..f005384 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/ctype_byname/2.cc @@ -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 index 0000000..5902a92 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/messages_byname/1.cc @@ -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 index 0000000..a9bf44c --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/moneypunct_byname/1.cc @@ -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 index 0000000..2fca03f --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/numpunct_byname/1.cc @@ -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(); +}