diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2015-01-20 11:50:51 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2015-01-20 11:50:51 +0000 |
commit | 71a16cd8bcb8d112a2a1db544b7f3aa9cfea67f8 (patch) | |
tree | b330b6dfc0fcea1b9f3d8f6ed8beee71add29a2c /libstdc++-v3/testsuite/22_locale | |
parent | 0e4974d62ecd488122ae99b0b2ed5afeb1d121eb (diff) | |
download | gcc-71a16cd8bcb8d112a2a1db544b7f3aa9cfea67f8.zip gcc-71a16cd8bcb8d112a2a1db544b7f3aa9cfea67f8.tar.gz gcc-71a16cd8bcb8d112a2a1db544b7f3aa9cfea67f8.tar.bz2 |
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.
From-SVN: r219887
Diffstat (limited to 'libstdc++-v3/testsuite/22_locale')
6 files changed, 278 insertions, 0 deletions
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(); +} |