Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libstdc++-v3 / testsuite / 27_io / basic_istream / exceptions / wchar_t / 9561.cc
blob46d8113cbc9f03b4f9144ba7d6535e3528f08b79
1 // Copyright (C) 2004 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 2, or (at your option)
7 // any later version.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING. If not, write to the Free
16 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 // USA.
19 #include <istream>
20 #include <streambuf>
21 #include <testsuite_hooks.h>
22 #include <testsuite_io.h>
24 // libstdc++/9561
25 void test01()
27 using namespace std;
28 bool test __attribute__((unused)) = true;
30 __gnu_test::fail_wstreambuf b;
31 std::wistream strm (&b);
32 strm.exceptions (std::wios::badbit);
33 wchar_t i = 0;
35 try
37 i = strm.get();
38 i = strm.get();
39 i = strm.get();
41 catch (__gnu_test::underflow_error&)
43 // strm should throw facet_error and not do anything else
44 VERIFY(strm.bad());
46 catch (...)
48 VERIFY( false );
51 VERIFY( i == L's' );
55 int main()
57 test01();
58 return 0;