]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/pod/3983-2.cc
Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_istream / extractors_character / pod / 3983-2.cc
1 // 2001-06-05 Benjamin Kosnik <bkoz@redhat.com>
2
3 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
20
21
22 // 27.4.2.1.6 class ios_base::init
23
24 #include <sstream>
25 #include <typeinfo>
26 #include <testsuite_hooks.h>
27 #include <testsuite_character.h>
28
29 // libstdc++/3983
30 // Sentry uses locale info, so have to try one formatted input/output.
31 void test03()
32 {
33 using namespace std;
34 using __gnu_test::pod_ushort;
35 typedef pod_ushort::value_type value_type;
36 typedef basic_stringbuf<pod_ushort> stringbuf_type;
37 typedef basic_istream<pod_ushort> istream_type;
38
39 stringbuf_type strbuf01;
40 istream_type iss(&strbuf01);
41
42 bool test __attribute__((unused)) = true;
43
44 // input streams
45 pod_ushort arr[6] = { { value_type('a') }, { value_type('b') },
46 { value_type('c') }, { value_type('d') },
47 { value_type('e') } };
48
49 try
50 {
51 iss >> arr;
52 }
53 catch (std::bad_cast& obj)
54 { }
55 catch (std::exception& obj)
56 { VERIFY( false ); }
57 }
58
59 #if !__GXX_WEAK__
60 // Explicitly instantiate for systems with no COMDAT or weak support.
61 template
62 const std::basic_string<__gnu_test::pod_ushort>::size_type
63 std::basic_string<__gnu_test::pod_ushort>::_Rep::_S_max_size;
64
65 template
66 const __gnu_test::pod_ushort
67 std::basic_string<__gnu_test::pod_ushort>::_Rep::_S_terminal;
68 #endif
69
70 int main()
71 {
72 test03();
73 return 0;
74 }