From patchwork Mon Jan 19 13:27:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 430445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 339291401F0 for ; Tue, 20 Jan 2015 00:27:40 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=mgUpSalzoTXpcTPvQJVZbtk7ko01c/ nrnU10/Z2psZPFvvmxPWT8BtTRXe3GscrEtE1qVcpql+qFnPQQd1K0ibIkRDxo4b oOjdh/hDi2/0hV29epcyk4TwgCztShOv2Q8kRs9QCHca6Iu1S4ORFoto0nsTdeXm iX4EnSM+I4nCs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=PUd9cztj0pal0Ab+d4WScEbMdjw=; b=Hy2K BJTQwYvR/uvpR0Aj0B34S2ANt0mesC5rTy4m8ZqXb9m1So5SQArQ1UvWsaFT8R8R uAtkvihaVyS7HHBlf8f8/ZxKii+NfJyAe2+WUWviBB88HvwGC3DEZ3/QUh5VweoM mO7xRH2sMFFv/iwdrgtqfj0P3ftAauahEusviRU= Received: (qmail 22342 invoked by alias); 19 Jan 2015 13:27:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 22321 invoked by uid 89); 19 Jan 2015 13:27:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 19 Jan 2015 13:27:20 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0JDRJrq026854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 19 Jan 2015 08:27:19 -0500 Received: from localhost (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0JDRHnl022957; Mon, 19 Jan 2015 08:27:18 -0500 Date: Mon, 19 Jan 2015 13:27:17 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [patch] Add and last pieces of C++11 std::lib Message-ID: <20150119132717.GF3360@redhat.com> References: <20150116233830.GJ3360@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150116233830.GJ3360@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) On 16/01/15 23:38 +0000, Jonathan Wakely wrote: >This defines the C++11 header 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 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, codecvt_byname): 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, codecvt_byname): 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 + : public codecvt + { + public: + explicit + codecvt_byname(const char* __s, size_t __refs = 0) + : codecvt(__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 + : public codecvt + { + public: + explicit + codecvt_byname(const char* __s, size_t __refs = 0) + : codecvt(__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 >(const locale&); #endif + +#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1) + extern template class codecvt_byname; + extern template class codecvt_byname; +#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::do_max_length() const throw() inline template class __codecvt_abstract_base; inline template class __codecvt_abstract_base; +template class codecvt_byname; +template class codecvt_byname; _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; template class time_put >; template class time_put_byname >; +#else + // Instantiate constructor taking __cxx11::string + template time_put_byname::time_put_byname(const string&, size_t); #endif _GLIBCXX_BEGIN_NAMESPACE_CXX11 template class time_get >; @@ -205,6 +208,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_END_NAMESPACE_CXX11 // ctype + ctype_byname::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; template class ctype_byname; @@ -214,6 +220,9 @@ _GLIBCXX_END_NAMESPACE_CXX11 #if ! _GLIBCXX_USE_CXX11_ABI inline template class __codecvt_abstract_base; template class codecvt_byname; +#else + // Instantiate constructor taking __cxx11::string + template codecvt_byname::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 +// . + +// { dg-options "-std=gnu++11" } +// { dg-do link } + +#include +#include + +std::string s = "C"; + +template +struct facet : std::codecvt_byname +{ + facet() : std::codecvt_byname(s) { } +}; + +void +test01() +{ + facet c; + +#ifdef _GLIBCXX_USE_WCHAR_T + facet 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 +// . + +// { dg-options "-std=gnu++11" } +// { dg-do link } + +#include +#include + +std::string s = "C"; + +template +struct facet : std::collate_byname +{ + facet() : std::collate_byname(s) { } +}; + +void +test01() +{ + facet c; + +#ifdef _GLIBCXX_USE_WCHAR_T + facet 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 +// . + +// { dg-options "-std=gnu++11" } +// { dg-do link } + +#include +#include + +std::string s = "C"; + +template +struct facet : std::ctype_byname +{ + facet() : std::ctype_byname(s) { } +}; + +void +test01() +{ + facet c; + +#ifdef _GLIBCXX_USE_WCHAR_T + facet 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 +// . + +// { dg-options "-std=gnu++11" } +// { dg-do link } + +#include +#include + +std::string s = "C"; + +template +struct facet : std::messages_byname +{ + facet() : std::messages_byname(s) { } +}; + +void +test01() +{ + facet c; + +#ifdef _GLIBCXX_USE_WCHAR_T + facet 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 +// . + +// { dg-options "-std=gnu++11" } +// { dg-do link } + +#include +#include + +std::string s = "C"; + +template +struct facet : std::moneypunct_byname +{ + facet() : std::moneypunct_byname(s) { } +}; + +void +test01() +{ + facet c0; + facet c1; + +#ifdef _GLIBCXX_USE_WCHAR_T + facet w0; + facet 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 +// . + +// { dg-options "-std=gnu++11" } +// { dg-do link } + +#include +#include + +std::string s = "C"; + +template +struct facet : std::numpunct_byname +{ + facet() : std::numpunct_byname(s) { } +}; + +void +test01() +{ + facet c; + +#ifdef _GLIBCXX_USE_WCHAR_T + facet w; +#endif +} + +int +main() +{ + test01(); +}