]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/codecvt_byname/50714.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 22_locale / codecvt_byname / 50714.cc
1 // { dg-require-namedlocale "de_DE.ISO8859-15" }
2
3 // Copyright (C) 2011-2023 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
19
20 #include <locale>
21 #include <ext/pod_char_traits.h>
22 #include <testsuite_hooks.h>
23
24 #define mychar __gnu_cxx::character<unsigned short, int>
25
26 namespace std
27 {
28 template<> codecvt<mychar, char, mbstate_t>::~codecvt()
29 { }
30
31 template<>
32 codecvt<mychar, char, mbstate_t>::result
33 codecvt<mychar, char, mbstate_t>::
34 do_out(state_type&, const intern_type*, const intern_type*,
35 const intern_type*&, extern_type*, extern_type*,
36 extern_type*&) const
37 { return codecvt_base::ok; }
38
39 template<>
40 codecvt<mychar, char, mbstate_t>::result
41 codecvt<mychar, char, mbstate_t>::
42 do_in(state_type&, const extern_type*, const extern_type*,
43 const extern_type*&, intern_type*, intern_type*,
44 intern_type*&) const
45 { return codecvt_base::ok; }
46
47 template<>
48 codecvt<mychar, char, mbstate_t>::result
49 codecvt<mychar, char, mbstate_t>::
50 do_unshift(state_type&, extern_type*, extern_type*,
51 extern_type*&) const
52 { return noconv; }
53
54 template<>
55 int
56 codecvt<mychar, char, mbstate_t>::do_encoding() const throw()
57 { return 0; }
58
59 template<>
60 bool
61 codecvt<mychar, char, mbstate_t>::do_always_noconv() const throw()
62 { return false; }
63
64 template<>
65 int
66 codecvt<mychar, char, mbstate_t>::
67 do_length(state_type&, const extern_type*, const extern_type*,
68 size_t) const
69 { return 0; }
70
71 template<>
72 int
73 codecvt<mychar, char, mbstate_t>::do_max_length() const throw()
74 { return 4; }
75 }
76
77 // libstdc++/50714
78 void test01()
79 {
80 using namespace std;
81
82 {
83 locale loc(locale::classic(),
84 new codecvt<mychar, char, mbstate_t>());
85 }
86 {
87 locale loc2(locale::classic(),
88 new codecvt_byname<mychar, char, mbstate_t>(ISO_8859(15,de_DE)));
89 }
90 }
91
92 int main()
93 {
94 test01();
95 return 0;
96 }