summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog70
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/exceptions/wchar_t/9561.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc125
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/02.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/03.cc45
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/06.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/07.cc145
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/08.cc66
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/09.cc48
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc130
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/11.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc73
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/13.cc67
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/9555-ia.cc86
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_badbit_throw.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit_throw.cc77
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc80
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/11095-i.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc92
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/9555-ic.cc71
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc3
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc138
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc57
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/3.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9318-in.cc69
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9424-in.cc112
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9555-io.cc68
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/error_failbit.cc67
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_badbit_throw.cc79
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_failbit_throw.cc89
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc68
-rw-r--r--libstdc++-v3/testsuite/testsuite_io.h6
34 files changed, 2459 insertions, 5 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 58621792197..c7f9b117d27 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,73 @@
+2004-12-19 Paolo Carlini <pcarlini@suse.de>
+
+ * testsuite/27_io/basic_istream/exceptions/wchar_t/9561.cc: New.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 01.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 02.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 03.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 06.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 07.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 08.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 09.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 10.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 11.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 12.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 13.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ 9555-ia.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ exceptions_badbit_throw.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ exceptions_failbit.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ exceptions_failbit_throw.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/wchar_t/
+ 1.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/wchar_t/
+ 11095-i.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/wchar_t/
+ 2.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/wchar_t/
+ 3.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_character/wchar_t/
+ 9555-ic.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ 1.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ 2.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ 3.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ 9318-in.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ 9424-in.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ 9555-io.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ error_failbit.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ exceptions_badbit_throw.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ exceptions_failbit_throw.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ exceptions_null.cc: Likewise.
+
+ * testsuite/27_io/basic_istream/extractors_other/char/2.cc: Minor
+ tweaks.
+
+ * testsuite/testsuite_io.h (struct fail_buf): Fix type of
+ dummy return values.
+
2004-12-19 Dhruv Matani <dhruvbird@gmx.net>
* include/ext/bitmap_allocator.h: Make doxygen style comments for
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/exceptions/wchar_t/9561.cc b/libstdc++-v3/testsuite/27_io/basic_istream/exceptions/wchar_t/9561.cc
new file mode 100644
index 00000000000..91468001813
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/exceptions/wchar_t/9561.cc
@@ -0,0 +1,59 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <istream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+#include <testsuite_io.h>
+
+// libstdc++/9561
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ __gnu_test::fail_wstreambuf b;
+ std::wistream strm (&b);
+ strm.exceptions (std::wios::badbit);
+ wchar_t i = 0;
+
+ try
+ {
+ i = strm.get();
+ i = strm.get();
+ i = strm.get();
+ }
+ catch (__gnu_test::underflow_error&)
+ {
+ // strm should throw facet_error and not do anything else
+ VERIFY(strm.bad());
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ VERIFY( i == L's' );
+}
+
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc
new file mode 100644
index 00000000000..a0106240e2d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/01.cc
@@ -0,0 +1,125 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <cstdio> // for printf
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+std::wstring str_01;
+std::wstring str_02(L"true false 0 1 110001");
+std::wstring str_03(L"-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5");
+std::wstring str_04(L"0123");
+
+std::wstringbuf isbuf_01(std::ios_base::in);
+std::wstringbuf isbuf_02(str_02, std::ios_base::in);
+std::wstringbuf isbuf_03(str_03, std::ios_base::in);
+std::wstringbuf isbuf_04(str_04, std::ios_base::in);
+
+std::wistream is_01(NULL);
+std::wistream is_02(&isbuf_02);
+std::wistream is_03(&isbuf_03);
+std::wistream is_04(&isbuf_04);
+std::wstringstream ss_01(str_01);
+
+// minimal sanity check
+bool test01() {
+
+ bool test __attribute__((unused)) = true;
+
+ // Integral Types:
+ bool b1 = false;
+ short s1 = 0;
+ int i1 = 0;
+ long l1 = 0;
+ unsigned short us1 = 0;
+ unsigned int ui1 = 0;
+ unsigned long ul1 = 0;
+
+ // Floating-point Types:
+ float f1 = 0;
+ double d1 = 0;
+ long double ld1 = 0;
+
+ // process alphanumeric versions of bool values
+ std::ios_base::fmtflags fmt = is_02.flags();
+ bool testfmt = fmt & std::ios_base::boolalpha;
+ is_02.setf(std::ios_base::boolalpha);
+ fmt = is_02.flags();
+ testfmt = fmt & std::ios_base::boolalpha;
+ is_02 >> b1;
+ VERIFY( b1 == 1 );
+ is_02 >> b1;
+ VERIFY( b1 == 0 );
+
+ // process numeric versions of of bool values
+ is_02.unsetf(std::ios_base::boolalpha);
+ fmt = is_02.flags();
+ testfmt = fmt & std::ios_base::boolalpha;
+ is_02 >> b1;
+ VERIFY( b1 == 0 );
+ is_02 >> b1;
+ VERIFY( b1 == 1 );
+
+ // is_03 == "-19999999 777777 -234234 233 -234 33 1 66300.25 .315 1.5"
+ is_03 >> l1;
+ VERIFY( l1 == -19999999 );
+ is_03 >> ul1;
+ VERIFY( ul1 == 777777 );
+ is_03 >> i1;
+ VERIFY( i1 == -234234 );
+ is_03 >> ui1;
+ VERIFY( ui1 == 233 );
+ is_03 >> s1;
+ VERIFY( s1 == -234 );
+ is_03 >> us1;
+ VERIFY( us1 == 33 );
+ is_03 >> b1;
+ VERIFY( b1 == 1 );
+ is_03 >> ld1;
+ VERIFY( ld1 == 66300.25 );
+ is_03 >> d1;
+ VERIFY( d1 == .315 );
+ is_03 >> f1;
+ VERIFY( f1 == 1.5 );
+
+ is_04 >> std::hex >> i1;
+ std::printf ("%d %d %d\n", i1, i1 == 0x123, test);
+ VERIFY( i1 == 0x123 );
+ std::printf ("%d %d %d\n", i1, i1 == 0x123, test);
+
+ // test void pointers
+ int i = 55;
+ void* po = &i;
+ void* pi;
+
+ ss_01 << po;
+ ss_01 >> pi;
+ std::printf ("%p %p\n", pi, po);
+ VERIFY( po == pi );
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/02.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/02.cc
new file mode 100644
index 00000000000..cfd0fae1406
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/02.cc
@@ -0,0 +1,46 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+// elaborated test for ints
+bool test02()
+{
+ bool test __attribute__((unused)) = true;
+ const std::wstring str_01(L"20000AB");
+ std::wstringbuf strb_01(str_01, std::ios_base::in);
+ std::wistream is(&strb_01);
+
+ int n = 15;
+ is >> n;
+ VERIFY( n == 20000 );
+ wchar_t c = is.peek();
+ VERIFY( c == L'A' );
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/03.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/03.cc
new file mode 100644
index 00000000000..0f9d9a93836
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/03.cc
@@ -0,0 +1,45 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+bool test03()
+{
+ std::wstringbuf sbuf;
+ std::wistream istr(&sbuf);
+ std::wostream ostr(&sbuf);
+
+ bool test __attribute__((unused)) = true;
+ long l01;
+ ostr << L"12220101";
+ istr >> l01; // _M_in_end set completely incorrectly here.
+ VERIFY( l01 == 12220101 );
+ VERIFY( istr.rdstate() == std::ios_base::eofbit );
+ return test;
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/06.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/06.cc
new file mode 100644
index 00000000000..d4e5d5cbee5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/06.cc
@@ -0,0 +1,59 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+// http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00081.html
+// Jim Parsons
+void test06()
+{
+ // default locale, grouping is turned off
+ bool test __attribute__((unused)) = true;
+ unsigned int h4;
+ wchar_t c;
+ std::wstring s(L"205,199,144");
+ std::wistringstream is(s);
+
+ is >> h4; // 205
+ VERIFY( h4 == 205 );
+ is >> c; // L','
+ VERIFY( c == L',' );
+
+ is >> h4; // 199
+ VERIFY( h4 == 199 );
+ is >> c; // L','
+ VERIFY( c == L',' );
+
+ is >> h4; // 144
+ VERIFY( is.rdstate() == std::ios_base::eofbit );
+ VERIFY( h4 == 144 );
+ is >> c; // EOF
+ VERIFY( c == L',' );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/07.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/07.cc
new file mode 100644
index 00000000000..fe7adbd70f5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/07.cc
@@ -0,0 +1,145 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+namespace std {
+ class test_numpunct1 : public numpunct<wchar_t>
+ {
+ protected:
+ string
+ do_grouping() const
+ { return string(1, '\003'); }
+ };
+} // namespace std
+
+void test07()
+{
+ // manufactured locale, grouping is turned on
+ bool test __attribute__((unused)) = true;
+ unsigned int h4 = 0, h3 = 0, h2 = 0;
+ float f1 = 0.0;
+ const std::wstring s1(L"205,199 23,445.25 1,024,365 123,22,24");
+ std::wistringstream is(s1);
+ is.imbue(std::locale(std::locale(), new std::test_numpunct1));
+
+ // Basic operation.
+ is >> h4;
+ VERIFY( h4 == 205199 );
+ VERIFY( is.good() );
+
+ is.clear();
+ is >> f1;
+ VERIFY( f1 == 23445.25 );
+ VERIFY( is.good() );
+
+ is.clear();
+ is >> h3;
+ VERIFY( h3 == 1024365 );
+ VERIFY( is.good() );
+
+ is.clear();
+ is >> h2;
+ VERIFY( h2 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) );
+
+ // Stress tests for explicit errors in grouping corner cases. The
+ // validity of these tests and results have been hammered out in
+ // private email between bkoz and ncm between Jan 25 and Jan 27, 2000.
+ // Thanks nate -- benjamin
+ const std::wstring s2(L",111 4,,4 0.25,345 5..25 156,, 1,000000 1000000 1234,567");
+ h3 = h4 = h2 = 0;
+ f1 = 0.0;
+ const wchar_t c_control = L'?';
+ wchar_t c = c_control;
+ is.clear();
+ is.str(s2);
+
+ is >> h4;
+ VERIFY( h4 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+ is.clear();
+ is >> c;
+ VERIFY( c == L',' );
+ VERIFY( is.good() );
+
+ is.ignore(3);
+ is >> f1;
+ VERIFY( f1 == 0.0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+ is.clear();
+ is >> c;
+ VERIFY( c == L',' );
+ is >> c;
+ VERIFY( c == L'4' );
+ VERIFY( is.good() );
+
+ is >> f1;
+ VERIFY( f1 == 0.25 );
+ VERIFY( is.good() );
+ is >> c;
+ VERIFY( c == L',' );
+ is >> h2;
+ VERIFY( h2 == 345 );
+ VERIFY( is.good() );
+ f1 = 0.0;
+ h2 = 0;
+
+ is >> f1;
+ VERIFY( f1 == 5.0 );
+ VERIFY( is.good() );
+ is >> f1;
+ VERIFY( f1 == .25 );
+ VERIFY( is.good() );
+
+ is >> h3;
+ VERIFY( h3 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+ is.clear();
+ is >> c;
+ VERIFY( c == L',' ); // second one
+ VERIFY( is.good() );
+
+ is >> h2;
+ VERIFY( h2 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+ is.clear();
+
+ is >> h2;
+ VERIFY( h2 == 1000000 );
+ VERIFY( is.good() );
+ h2 = 0;
+
+ is >> h2;
+ VERIFY( h2 == 0 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::failbit) );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) );
+ is.clear();
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/08.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/08.cc
new file mode 100644
index 00000000000..cc3387c2ba4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/08.cc
@@ -0,0 +1,66 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+namespace std {
+ class test_numpunct2 : public numpunct<wchar_t>
+ {
+ protected:
+ string
+ do_grouping() const
+ { return string("\002\003"); }
+ };
+} // namespace std
+
+void test08()
+{
+ // manufactured locale, grouping is turned on
+ bool test __attribute__((unused)) = true;
+ unsigned int h4 = 0, h3 = 0, h2 = 0;
+ const std::wstring s1(L"1,22 205,19 22,123,22");
+
+ std::wistringstream is(s1);
+ is.imbue(std::locale(std::locale(), new std::test_numpunct2));
+
+ // Basic operation.
+ is >> h4;
+ VERIFY( h4 == 122 );
+ VERIFY( is.good() );
+
+ is.clear();
+ is >> h3;
+ VERIFY( h3 == 20519 );
+ VERIFY( is.good() );
+
+ is.clear();
+ is >> h2;
+ VERIFY( h2 == 2212322 );
+ VERIFY( static_cast<bool>(is.rdstate() & std::ios_base::eofbit) );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/09.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/09.cc
new file mode 100644
index 00000000000..0310c64779b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/09.cc
@@ -0,0 +1,48 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+bool test09()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wstring st(L"2.456e3-+0.567e-2");
+ std::wstringbuf sb(st);
+ std::wistream is(&sb);
+ double f1 = 0, f2 = 0;
+ wchar_t c;
+ (is >> std::ws) >> f1;
+ (is >> std::ws) >> c;
+ (is >> std::ws) >> f2;
+ test = f1 == 2456;
+ VERIFY( f2 == 0.00567 );
+ VERIFY( c == L'-' );
+ return test;
+}
+
+int main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc
new file mode 100644
index 00000000000..c3159603678
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/10.cc
@@ -0,0 +1,130 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+bool test10()
+{
+ std::wstring str_01(L"0 00 000 +0 +0 -0");
+ std::wstringbuf isbuf_01(str_01);
+ std::wistream is_01(&isbuf_01);
+
+ bool test __attribute__((unused)) = true;
+
+ int n = 365;
+ is_01 >> n;
+ VERIFY( n == 0 );
+ n = 364;
+ is_01 >> n;
+ VERIFY( n == 0 );
+ n = 363;
+ is_01 >> n;
+ VERIFY( n == 0 );
+ n = 362;
+ is_01 >> n;
+ VERIFY( n == 0 );
+ n = 361;
+ is_01 >> n;
+ VERIFY( n == 0 );
+ n = 360;
+ is_01 >> n;
+ VERIFY( n == 0 );
+ VERIFY( is_01.rdstate() == std::ios_base::eofbit );
+
+ std::wstring str_02(L"0x32 0X33 033 33");
+ std::wstringbuf isbuf_02(str_02);
+ std::wistream is_02(&isbuf_02);
+ is_02.unsetf(std::ios_base::basefield);
+ is_02 >> n;
+ VERIFY( n == 50 );
+ is_02 >> n;
+ VERIFY( n == 51 );
+ is_02 >> n;
+ VERIFY( n == 27 );
+ is_02 >> n;
+ VERIFY( n == 33 );
+ VERIFY( is_02.rdstate() == std::ios_base::eofbit );
+
+ std::wstringbuf isbuf_03(str_02);
+ std::wistream is_03(&isbuf_03);
+ wchar_t c;
+ int m;
+
+ is_03 >> std::dec >> n >> c >> m;
+ VERIFY( n == 0 );
+ VERIFY( c == L'x' );
+ VERIFY( m == 32 );
+
+ is_03 >> std::oct >> m >> c >> n;
+ VERIFY( m == 0 );
+ VERIFY( c == L'X' );
+ VERIFY( n == 27 );
+
+ is_03 >> std::dec >> m >> n;
+ VERIFY( m == 33 );
+ VERIFY( n == 33 );
+ VERIFY( is_03.rdstate() == std::ios_base::eofbit );
+
+ std::wstring str_04(L"3. 4.5E+2a5E-3 .6E1");
+ std::wstringbuf isbuf_04(str_04);
+ std::wistream is_04(&isbuf_04);
+
+ double f;
+ is_04 >> f;
+ VERIFY( f == 3.0 );
+ is_04 >> f;
+ VERIFY( f == 450.0 );
+ is_04.ignore();
+ is_04 >> f;
+ VERIFY( f == 0.005 );
+ is_04 >> f;
+ VERIFY( f == 6 );
+ VERIFY( is_03.rdstate() == std::ios_base::eofbit );
+
+ std::wstring str_05(L"0E20 5Ea E16");
+ std::wstringbuf isbuf_05(str_05);
+ std::wistream is_05(&isbuf_05);
+
+ is_05 >> f;
+ VERIFY( f == 0 );
+ is_05 >> f;
+ VERIFY( f == 5.0 );
+ VERIFY( is_05.rdstate() == std::ios_base::goodbit );
+ is_05.clear();
+ is_05 >> c;
+ VERIFY( c == L'a' );
+ is_05 >> f;
+ VERIFY( f == 5.0 );
+ VERIFY( is_05.rdstate() == std::ios_base::failbit );
+ is_05.clear();
+ is_05.ignore();
+ is_05 >> n;
+ VERIFY( n == 16 );
+ return test;
+}
+
+int main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/11.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/11.cc
new file mode 100644
index 00000000000..b26d1238fc7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/11.cc
@@ -0,0 +1,54 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <cwchar>
+#include <testsuite_hooks.h>
+
+// In the presence of no fmtflags, the input operator should behave
+// like strtol(x, y, 0)
+// libstdc++/90
+bool test11()
+{
+ bool test __attribute__((unused)) = true;
+ const wchar_t* cstrlit = L"0x2a";
+
+ // sanity check via 'C' library call
+ wchar_t* err;
+ long l = std::wcstol(cstrlit, &err, 0);
+
+ std::wistringstream iss(cstrlit);
+ iss.setf(std::wios::fmtflags(0), std::ios::basefield);
+ int i;
+ iss >> i;
+
+ VERIFY( !iss.fail() );
+ VERIFY( l == i );
+
+ return test;
+}
+
+int main()
+{
+ test11();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc
new file mode 100644
index 00000000000..ef72afbcfbf
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc
@@ -0,0 +1,73 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+// XXX This test fails on sparc-solaris2 because of a bug in libc
+// XXX sscanf for very long input. See:
+// XXX http://gcc.gnu.org/ml/gcc/2002-12/msg01422.html
+// { dg-do run { xfail sparc*-*-solaris2* } }
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/3720
+// excess input should not cause a core dump
+template<typename T>
+bool test12_aux(bool integer_type)
+{
+ bool test __attribute__((unused)) = true;
+
+ int digits_overflow;
+ if (integer_type)
+ // This many digits will overflow integer types in base 10.
+ digits_overflow = std::numeric_limits<T>::digits10 + 2;
+ else
+ // This might do it, unsure.
+ digits_overflow = std::numeric_limits<T>::max_exponent10 + 1;
+
+ std::wstring st;
+ std::wstring part = L"1234567890123456789012345678901234567890";
+ for (std::size_t i = 0; i < digits_overflow / part.size() + 1; ++i)
+ st += part;
+ std::wstringbuf sb(st);
+ std::wistream is(&sb);
+ T t;
+ is >> t;
+ VERIFY( is.fail() );
+ return test;
+}
+
+bool test12()
+{
+ bool test __attribute__((unused)) = true;
+ VERIFY( test12_aux<short>(true) );
+ VERIFY( test12_aux<int>(true) );
+ VERIFY( test12_aux<long>(true) );
+ VERIFY( test12_aux<float>(false) );
+ VERIFY( test12_aux<double>(false) );
+ VERIFY( test12_aux<long double>(false) );
+ return test;
+}
+
+int main()
+{
+ test12();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/13.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/13.cc
new file mode 100644
index 00000000000..8fa3e3e55ef
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/13.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.2 arithmetic extractors
+
+#include <istream>
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+// libstdc++/3720 part two
+void test13()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+ const wchar_t* l2 = L"1.2345678901234567890123456789012345678901234567890123456"
+ L" "
+ L"1246.9";
+
+ // 1
+ // used to core.
+ double d;
+ wistringstream iss1(l2);
+ iss1 >> d;
+ iss1 >> d;
+ VERIFY ( d > 1246 && d < 1247 );
+
+ // 2
+ // quick test for failbit on maximum length extraction.
+ int i;
+ int max_digits = numeric_limits<int>::digits10 + 1;
+ wstring digits;
+ for (int j = 0; j < max_digits; ++j)
+ digits += L'1';
+ wistringstream iss2(digits);
+ iss2 >> i;
+ VERIFY( !iss2.fail() );
+
+ digits += L'1';
+ i = 0;
+ iss2.str(digits);
+ iss2.clear();
+ iss2 >> i;
+ VERIFY( i == 0 );
+ VERIFY( iss2.fail() );
+}
+
+int main()
+{
+ test13();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/9555-ia.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/9555-ia.cc
new file mode 100644
index 00000000000..98d9c25d6a4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/9555-ia.cc
@@ -0,0 +1,86 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <istream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+struct buf: std::wstreambuf
+{
+ virtual int_type overflow(int_type)
+ { throw 0; }
+};
+
+template<typename T>
+void testthrow(T arg)
+{
+ bool test __attribute__((unused)) = true;
+ buf b;
+ std::wistream is(&b);
+ is.exceptions(std::ios::badbit);
+
+ try
+ {
+ is >> arg;
+ }
+ catch(int)
+ {
+ // Expected return is zero.
+ VERIFY( is.bad() );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ bool b = true;
+ short s = -4;
+ unsigned short us = 4;
+ int i = -45;
+ unsigned int ui = 45;
+ long l = -456;
+ unsigned long ul = 456;
+ float f = 3.4;
+ double d = 3.45;
+ long double ld = 3.456;
+
+ testthrow(b);
+ testthrow(s);
+ testthrow(us);
+ testthrow(i);
+ testthrow(ui);
+ testthrow(l);
+ testthrow(ul);
+ testthrow(f);
+ testthrow(d);
+ testthrow(ld);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_badbit_throw.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_badbit_throw.cc
new file mode 100644
index 00000000000..4b0392ae8c0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_badbit_throw.cc
@@ -0,0 +1,74 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+#include <testsuite_io.h>
+
+// libstdc++/9561
+template<typename T>
+void test_badbit()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ locale loc(locale::classic(), new __gnu_test::fail_num_get_wchar_t);
+ wistringstream stream(L"jaylib - champion sound");
+ stream.imbue(loc);
+
+ stream.exceptions(ios_base::badbit);
+ VERIFY( stream.rdstate() == ios_base::goodbit );
+
+ try
+ {
+ T i;
+ stream >> i;
+ VERIFY( false );
+ }
+ catch (const __gnu_test::facet_error&)
+ {
+ // stream should set badbit and rethrow facet_error.
+ VERIFY( stream.bad() );
+ VERIFY( (stream.rdstate() & ios_base::failbit) == 0 );
+ VERIFY( !stream.eof() );
+ }
+ catch (...)
+ {
+ VERIFY(false);
+ }
+}
+
+
+int main()
+{
+ test_badbit<bool>();
+ test_badbit<short>();
+ test_badbit<unsigned short>();
+ test_badbit<int>();
+ test_badbit<unsigned int>();
+ test_badbit<long>();
+ test_badbit<unsigned long>();
+
+ test_badbit<float>();
+ test_badbit<double>();
+
+ test_badbit<void*>();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
new file mode 100644
index 00000000000..f45f0ab1f3f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
@@ -0,0 +1,74 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/10093
+template<typename T>
+void test_failbit()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wistringstream stream(L"jaylib - champion sound");
+ stream.exceptions(ios_base::failbit);
+
+ try
+ {
+ T i;
+ stream >> i;
+ VERIFY( false );
+ }
+ catch (const ios_base::failure&)
+ {
+ // stream should set failbit and throw ios_base::failure.
+ VERIFY( stream.fail() );
+ VERIFY( !stream.bad() );
+ VERIFY( !stream.eof() );
+ }
+ catch(...)
+ { VERIFY( false ); }
+}
+
+int main()
+{
+ test_failbit<bool>();
+ test_failbit<short>();
+ test_failbit<unsigned short>();
+ test_failbit<int>();
+ test_failbit<unsigned int>();
+ test_failbit<long>();
+ test_failbit<unsigned long>();
+
+ test_failbit<float>();
+ test_failbit<double>();
+
+ test_failbit<void*>();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit_throw.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit_throw.cc
new file mode 100644
index 00000000000..500952f0ecf
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit_throw.cc
@@ -0,0 +1,77 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <sstream>
+#include <testsuite_hooks.h>
+#include <testsuite_io.h>
+
+// libstdc++/10093
+template<typename T>
+void test_failbit()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ locale loc(locale::classic(), new __gnu_test::fail_num_get_wchar_t);
+ wistringstream stream(L"jaylib - champion sound");
+ stream.imbue(loc);
+
+ stream.exceptions(ios_base::failbit);
+
+ try
+ {
+ T i;
+ stream >> i;
+ }
+ catch (const ios_base::failure&)
+ { VERIFY( false ); }
+ catch(...)
+ { VERIFY( false ); }
+
+ // stream should set badbit.
+ VERIFY( stream.bad() );
+ VERIFY( (stream.rdstate() & ios_base::failbit) == 0 );
+ VERIFY( !stream.eof() );
+}
+
+int main()
+{
+ test_failbit<bool>();
+ test_failbit<short>();
+ test_failbit<unsigned short>();
+ test_failbit<int>();
+ test_failbit<unsigned int>();
+ test_failbit<long>();
+ test_failbit<unsigned long>();
+
+ test_failbit<float>();
+ test_failbit<double>();
+
+ test_failbit<void*>();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc
new file mode 100644
index 00000000000..351056ae049
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/1.cc
@@ -0,0 +1,80 @@
+// Copyright (C) 2004 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 character extractors
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::wstring str_01;
+ const std::wstring str_02(L"coltrane playing 'softly as a morning sunrise'");
+ const std::wstring str_03(L"coltrane");
+
+ std::wstringbuf isbuf_01(std::ios_base::in);
+ std::wstringbuf isbuf_02(str_02, std::ios_base::in);
+ std::wistream is_01(NULL);
+ std::wistream is_02(&isbuf_02);
+
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, _CharT*)
+ int n = 20;
+ wchar_t array1[n];
+ typedef std::wios::traits_type ctraits_type;
+ ctraits_type::int_type i1, i2;
+
+ state1 = is_01.rdstate();
+ i1 = ctraits_type::length(array1);
+ is_01 >> array1; // should snake 0 characters, not alter stream state
+ i2 = ctraits_type::length(array1);
+ state2 = is_01.rdstate();
+ VERIFY( i1 == i2 );
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake L"coltrane"
+ state2 = is_02.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
+ VERIFY( array1[str_03.size() - 1] == L'e' );
+ array1[str_03.size()] = L'\0';
+ VERIFY( !str_03.compare(0, str_03.size(), array1) );
+ std::wistream::int_type int1 = is_02.peek(); // should be L' '
+ VERIFY( int1 == L' ' );
+
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake L"playing" as sentry "eats" ws
+ state2 = is_02.rdstate();
+ int1 = is_02.peek(); // should be L' '
+ VERIFY( int1 == L' ' );
+ VERIFY( state1 == state2 );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/11095-i.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/11095-i.cc
new file mode 100644
index 00000000000..edbe8126990
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/11095-i.cc
@@ -0,0 +1,53 @@
+// Copyright (C) 2004 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 character extractors
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/11095
+// operator>>(basic_istream&, _CharT*)
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ const std::wstring str_01(L"Consoli ");
+
+ std::wstringbuf isbuf_01(str_01, std::ios_base::in);
+ std::wistream is_01(&isbuf_01);
+
+ std::ios_base::iostate state1, state2;
+
+ wchar_t array1[10];
+ typedef std::wios::traits_type ctraits_type;
+
+ is_01.width(-60);
+ state1 = is_01.rdstate();
+ is_01 >> array1;
+ state2 = is_01.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( !ctraits_type::compare(array1, L"Consoli", 7) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc
new file mode 100644
index 00000000000..8c591831f73
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/2.cc
@@ -0,0 +1,64 @@
+// Copyright (C) 2004 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 character extractors
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ std::wstring str_01;
+ const std::wstring str_02(L"or coltrane playing tunji with jimmy garrison");
+ const std::wstring str_03(L"coltrane");
+
+ std::wstringbuf isbuf_01(std::ios_base::in);
+ std::wstringbuf isbuf_02(str_02, std::ios_base::in);
+ std::wistream is_01(NULL);
+ std::wistream is_02(&isbuf_02);
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, _CharT&)
+ wchar_t c1 = L'c', c2 = L'c';
+ state1 = is_01.rdstate();
+ is_01 >> c1;
+ state2 = is_01.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( c1 == c2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+
+ state1 = is_02.rdstate();
+ is_02 >> c1;
+ state2 = is_02.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( c1 == L'o' );
+ is_02 >> c1;
+ is_02 >> c1;
+ VERIFY( c1 == L'c' );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc
new file mode 100644
index 00000000000..a22e13ac66c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/3.cc
@@ -0,0 +1,92 @@
+// Copyright (C) 2004 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 character extractors
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::wstring str_01;
+ const std::wstring str_02(L"coltrane playing 'softly as a morning sunrise'");
+ const std::wstring str_03(L"coltrane");
+
+ std::wstringbuf isbuf_01(std::ios_base::in);
+ std::wstringbuf isbuf_02(str_02, std::ios_base::in);
+ std::wistream is_01(NULL);
+ std::wistream is_02(&isbuf_02);
+
+ std::ios_base::iostate state1, state2, statefail;
+ statefail = std::ios_base::failbit;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(istream&, _CharT*)
+ int n = 20;
+ wchar_t array1[n];
+ typedef std::wios::traits_type ctraits_type;
+
+ // testing with width() control enabled.
+ is_02.width(8);
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake L"coltran"
+ state2 = is_02.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( !ctraits_type::compare(array1, L"coltran", 7) );
+
+ is_02.width(1);
+ state1 = is_02.rdstate();
+ is_02 >> array1; // should snake nothing, set failbit
+ state2 = is_02.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( state2 == statefail );
+ VERIFY( array1[0] == L'\0' );
+
+ is_02.width(8);
+ is_02.clear();
+ state1 = is_02.rdstate();
+ VERIFY( !state1 );
+ is_02 >> array1; // should snake L"e"
+ state2 = is_02.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( !ctraits_type::compare(array1, L"e", 1) );
+
+ // testing for correct exception setting
+ const std::wstring str_04(L" impulse!!");
+ std::wstringbuf isbuf_03(str_04, std::ios_base::in);
+ std::wstringbuf isbuf_04(str_04, std::ios_base::in);
+ std::wistream is_03(&isbuf_03);
+ std::wistream is_04(&isbuf_04);
+
+ is_03 >> array1;
+ VERIFY( !ctraits_type::compare(array1, L"impulse!!", 10) );
+ VERIFY( is_03.rdstate() == std::ios_base::eofbit );
+
+ is_04.width(9);
+ is_04 >> array1;
+ VERIFY( !ctraits_type::compare(array1, L"impulse!", 9) );
+ VERIFY( !is_04.rdstate() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/9555-ic.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/9555-ic.cc
new file mode 100644
index 00000000000..70db4cf8e97
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/wchar_t/9555-ic.cc
@@ -0,0 +1,71 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <istream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+struct buf: std::wstreambuf
+{
+ virtual int_type overflow(int_type)
+ { throw 0; }
+};
+
+template<typename T>
+void testthrow(T arg)
+{
+ bool test __attribute__((unused)) = true;
+ buf b;
+ std::wistream is(&b);
+ is.exceptions(std::wios::badbit);
+
+ try
+ {
+ is >> arg;
+ }
+ catch(int)
+ {
+ // Expected return is zero.
+ VERIFY( is.bad() );
+ }
+ catch(...)
+ {
+ test = false;
+ VERIFY( test );
+ }
+}
+
+int main()
+{
+ wchar_t c = L'a';
+ wchar_t* cp = &c;
+
+ testthrow(c);
+ testthrow(cp);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc
index f99fd7b0805..9f5c452ed7c 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/2.cc
@@ -1,6 +1,6 @@
// 1999-07-28 bkoz
-// Copyright (C) 1999, 2001, 2003 Free Software Foundation
+// Copyright (C) 1999, 2001, 2003, 2004 Free Software Foundation
//
// 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
@@ -30,7 +30,6 @@
void test02()
{
bool test __attribute__((unused)) = true;
- typedef std::ios::traits_type ctraits_type;
const char name_01[] = "istream_extractor_other-1.txt"; //read
const char name_02[] = "istream_extractor_other-2.txt"; //write
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc
new file mode 100644
index 00000000000..8eea02abf50
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/1.cc
@@ -0,0 +1,138 @@
+// Copyright (C) 2004 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 basic_istream::operator>>
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// stringbufs.
+void test01()
+{
+ typedef std::wios::traits_type ctraits_type;
+
+ bool test __attribute__((unused)) = true;
+ const std::wstring str_01;
+ const std::wstring str_02(L"art taylor kickin it on DAKAR");
+ std::wstring strtmp;
+
+ std::wstringbuf isbuf_00(std::ios_base::in);
+ std::wstringbuf isbuf_01(std::ios_base::in | std::ios_base::out);
+ std::wstringbuf isbuf_02(str_01, std::ios_base::in);
+ std::wstringbuf isbuf_03(str_01, std::ios_base::in | std::ios_base::out);
+ std::wstringbuf isbuf_04(str_02, std::ios_base::in);
+ std::wstringbuf isbuf_05(str_02, std::ios_base::in | std::ios_base::out);
+
+ std::wistream is_00(NULL);
+ std::wistream is_01(&isbuf_01);
+ std::wistream is_02(&isbuf_02);
+ std::wistream is_03(&isbuf_03);
+ std::wistream is_04(&isbuf_04);
+ std::wistream is_05(&isbuf_05);
+ std::ios_base::iostate state1, state2, statefail, stateeof;
+ statefail = std::ios_base::failbit;
+ stateeof = std::ios_base::eofbit;
+
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_streambuf*)
+
+ // null istream to empty in_buf
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_00;
+ state2 = is_00.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_00.str() == str_01 );
+
+ // null istream to empty in_out_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_01;
+ state2 = is_00.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_01.str() == str_01 );
+
+ // null istream to full in_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_04;
+ state2 = is_00.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_04.str() == str_02 );
+
+ // null istream to full in_out_buf
+ is_00.clear(std::ios_base::goodbit);
+ state1 = is_00.rdstate();
+ is_00 >> &isbuf_05;
+ state2 = is_00.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_05.str() == str_02 );
+
+ // empty but non-null istream to full in_buf
+ state1 = is_02.rdstate();
+ is_02 >> &isbuf_04;
+ state2 = is_02.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_04.str() == str_02 ); // as only an "in" buffer
+ VERIFY( isbuf_04.sgetc() == L'a' );
+
+ // empty but non-null istream to full in_out_buf
+ is_02.clear(std::ios_base::goodbit);
+ state1 = is_02.rdstate();
+ is_02 >> &isbuf_05;
+ state2 = is_02.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_05.str() == str_02 ); // as only an "in" buffer
+ VERIFY( isbuf_05.sgetc() == L'a' );
+
+ // full istream to empty in_buf (need out_buf, you know?)
+ state1 = is_04.rdstate();
+ is_04 >> &isbuf_02;
+ state2 = is_04.rdstate();
+ VERIFY( state1 != state2 );
+ VERIFY( static_cast<bool>(state2 & statefail) );
+ VERIFY( isbuf_02.str() == str_01 ); // as only an "in" buffer
+ VERIFY( isbuf_02.sgetc() == ctraits_type::eof() );
+ VERIFY( is_04.peek() == ctraits_type::eof() ); // as failed
+
+ // full istream to empty in_out_buf
+ is_04.clear(std::ios_base::goodbit);
+ state1 = is_04.rdstate();
+ is_04 >> &isbuf_03;
+ state2 = is_04.rdstate();
+ VERIFY( state1 == state2 );
+ VERIFY( !static_cast<bool>(state2 & statefail) );
+ VERIFY( state2 != stateeof );
+ strtmp = isbuf_03.str();
+ VERIFY( strtmp == str_02 ); // as only an "in" buffer
+ VERIFY( isbuf_03.sgetc() == L'a' );
+ VERIFY( is_04.peek() == ctraits_type::eof() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc
new file mode 100644
index 00000000000..4bdbe50ac88
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc
@@ -0,0 +1,57 @@
+// Copyright (C) 2004 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 basic_istream::operator>>
+// @require@ %-*.tst %-*.txt
+// @diff@ %-*.tst %-*.txt
+
+#include <istream>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+// filebufs.
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ const char name_01[] = "istream_extractor_other-1.txt"; //read
+ const char name_02[] = "wistream_extractor_other-2.txt"; //write
+
+ std::wfilebuf fbin, fbout;
+ fbin.open(name_01, std::ios_base::in);
+ fbout.open(name_02, std::ios_base::out | std::ios_base::trunc);
+ VERIFY( fbin.is_open() );
+ VERIFY( fbout.is_open() );
+
+ if (test)
+ {
+ std::wistream is(&fbin);
+ is.unsetf(std::ios_base::skipws);
+ is >> &fbout;
+ }
+
+ fbout.close();
+ fbin.close();
+ VERIFY( !fbin.is_open() );
+ VERIFY( !fbout.is_open() );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/3.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/3.cc
new file mode 100644
index 00000000000..b0849721b6e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/3.cc
@@ -0,0 +1,50 @@
+// Copyright (C) 2004 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.6.1.2.3 basic_istream::operator>>
+
+#include <istream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(ios_base& (*pf) (ios_base&))
+ {
+ int i = 0;
+ std::wistringstream iss(L" 43");
+ iss >> std::noskipws >> i;
+ VERIFY ( !iss ); //should set failbit
+ }
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_ios& (*pf) (basic_ios&))
+
+ // template<_CharT, _Traits>
+ // basic_istream& operator>>(basic_istream& (*pf) (basic_istream&))
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9318-in.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9318-in.cc
new file mode 100644
index 00000000000..a2ba62441d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9318-in.cc
@@ -0,0 +1,69 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.5.2 template class basic_streambuf
+
+#include <sstream>
+#include <istream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9318
+class Outbuf : public std::wstreambuf
+{
+public:
+ typedef std::wstreambuf::traits_type traits_type;
+
+ std::wstring result() const { return str; }
+
+protected:
+ virtual int_type overflow(int_type c = traits_type::eof())
+ {
+ if (!traits_type::eq_int_type(c, traits_type::eof()))
+ str.push_back(traits_type::to_char_type(c));
+ return traits_type::not_eof(c);
+ }
+
+private:
+ std::wstring str;
+};
+
+void test09()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wistringstream stream(L"Bad Moon Rising");
+ Outbuf buf;
+ stream >> &buf;
+
+ VERIFY( buf.result() == L"Bad Moon Rising" );
+}
+
+int main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9424-in.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9424-in.cc
new file mode 100644
index 00000000000..21ebeb443d2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9424-in.cc
@@ -0,0 +1,112 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 27.5.2 template class basic_streambuf
+
+#include <cstring>
+#include <cwchar>
+#include <streambuf>
+#include <sstream>
+#include <ostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/9424
+class Outbuf_2 : public std::wstreambuf
+{
+ wchar_t buf[1];
+
+public:
+ Outbuf_2()
+ {
+ setp(buf, buf + 1);
+ }
+
+ int_type overflow(int_type c)
+ {
+ int_type eof = traits_type::eof();
+
+ if (pptr() < epptr())
+ {
+ if (traits_type::eq_int_type(c, eof))
+ return traits_type::not_eof(c);
+
+ *pptr() = traits_type::to_char_type(c);
+ pbump(1);
+ return c;
+ }
+
+ return eof;
+ }
+};
+
+class Inbuf_2 : public std::wstreambuf
+{
+ static const wchar_t buf[];
+ const wchar_t* current;
+ int size;
+
+public:
+ Inbuf_2()
+ {
+ current = buf;
+ size = std::wcslen(buf);
+ }
+
+ int_type underflow()
+ {
+ if (current < buf + size)
+ return traits_type::to_int_type(*current);
+ return traits_type::eof();
+ }
+
+ int_type uflow()
+ {
+ if (current < buf + size)
+ return traits_type::to_int_type(*current++);
+ return traits_type::eof();
+ }
+};
+
+const wchar_t Inbuf_2::buf[] = L"Atteivlis";
+
+void test11()
+{
+ bool test __attribute__((unused)) = true;
+
+ Inbuf_2 inbuf1;
+ std::wistream is(&inbuf1);
+ Outbuf_2 outbuf1;
+ is >> &outbuf1;
+ VERIFY( inbuf1.sgetc() == L't' );
+ VERIFY( is.good() );
+}
+
+int main()
+{
+ test11();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9555-io.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9555-io.cc
new file mode 100644
index 00000000000..8ca81dd2b06
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/9555-io.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <istream>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+struct buf: std::wstreambuf
+{
+ virtual int_type overflow(int_type)
+ { throw 0; }
+};
+
+template<typename T>
+void testthrow(T arg)
+{
+ bool test __attribute__((unused)) = true;
+ buf b;
+ std::wistream is(&b);
+ is.exceptions(std::wios::badbit);
+
+ try
+ {
+ is >> arg;
+ }
+ catch(int)
+ {
+ // Expected return is zero.
+ VERIFY( is.bad() );
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ buf b;
+
+ testthrow(&b);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/error_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/error_failbit.cc
new file mode 100644
index 00000000000..ff23e84396e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/error_failbit.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <istream>
+#include <streambuf>
+#include <sstream>
+#include <testsuite_hooks.h>
+#include <testsuite_io.h>
+
+using namespace std;
+
+void test6()
+{
+ bool test __attribute__((unused)) = true;
+ __gnu_test::fail_wstreambuf bib;
+ wistream stream(&bib);
+ wstringbuf sbuf(L"", ios_base::out);
+
+ stream >> &sbuf;
+
+ VERIFY( stream.rdstate() & ios_base::failbit );
+ VERIFY( (stream.rdstate() & ios_base::badbit) == 0 );
+}
+
+void test8()
+{
+ bool test __attribute__((unused)) = true;
+ wistringstream stream(L"foo, bar, qux");
+ __gnu_test::fail_wstreambuf bob;
+
+ stream >> &bob;
+
+ VERIFY( stream.rdstate() & ios_base::failbit );
+ VERIFY( (stream.rdstate() & ios_base::badbit) == 0 );
+}
+
+// libstdc++/9371
+int main()
+{
+ test6();
+ test8();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_badbit_throw.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_badbit_throw.cc
new file mode 100644
index 00000000000..f114b3cf1e1
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_badbit_throw.cc
@@ -0,0 +1,79 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <istream>
+#include <streambuf>
+#include <sstream>
+#include <testsuite_hooks.h>
+#include <testsuite_io.h>
+
+using namespace std;
+
+void test14()
+{
+ bool test __attribute__((unused)) = true;
+ __gnu_test::fail_wstreambuf bib;
+ wistream stream(&bib);
+ stream.exceptions(ios_base::badbit);
+ wstringbuf sbuf(L"", ios_base::out);
+
+ try
+ {
+ stream >> &sbuf;
+ }
+ catch (...)
+ { VERIFY( false ); }
+
+ VERIFY( stream.rdstate() & ios_base::failbit );
+ VERIFY( (stream.rdstate() & ios_base::badbit) == 0 );
+}
+
+void test16()
+{
+ bool test __attribute__((unused)) = true;
+ wistringstream stream(L"foo, bar, qux");
+ stream.exceptions(ios_base::badbit);
+ __gnu_test::fail_wstreambuf bob;
+
+ try
+ {
+ stream >> &bob;
+ }
+ catch (...)
+ { VERIFY( false ); }
+
+ VERIFY( stream.rdstate() & ios_base::failbit );
+ VERIFY( (stream.rdstate() & ios_base::badbit) == 0 );
+}
+
+// libstdc++/9371
+int main()
+{
+ test14();
+ test16();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_failbit_throw.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_failbit_throw.cc
new file mode 100644
index 00000000000..d546ef33a19
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_failbit_throw.cc
@@ -0,0 +1,89 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <istream>
+#include <streambuf>
+#include <sstream>
+#include <testsuite_hooks.h>
+#include <testsuite_io.h>
+
+using namespace std;
+
+void test10()
+{
+ bool test __attribute__((unused)) = true;
+ __gnu_test::fail_wstreambuf bib;
+ wistream stream(&bib);
+ stream.exceptions(ios_base::failbit);
+ wstringbuf sbuf(L"", ios_base::out);
+
+ try
+ {
+ stream >> &sbuf;
+ VERIFY( false );
+ }
+ catch (ios_base::failure&)
+ { VERIFY( false ); }
+ catch (__gnu_test::underflow_error&)
+ { }
+ catch (...)
+ { VERIFY( false ); }
+
+ VERIFY( stream.rdstate() & ios_base::failbit );
+ VERIFY( (stream.rdstate() & ios_base::badbit) == 0 );
+}
+
+void test12()
+{
+ bool test __attribute__((unused)) = true;
+ wistringstream stream(L"foo, bar, qux");
+ stream.exceptions(ios_base::failbit);
+ __gnu_test::fail_wstreambuf bob;
+
+ try
+ {
+ stream >> &bob;
+ VERIFY( false );
+ }
+ catch (ios_base::failure&)
+ { VERIFY( false ); }
+ catch (__gnu_test::overflow_error&)
+ { }
+ catch (...)
+ { VERIFY( false ); }
+
+ VERIFY( stream.rdstate() & ios_base::failbit );
+ VERIFY( (stream.rdstate() & ios_base::badbit) == 0 );
+}
+
+// libstdc++/9371
+int main()
+{
+ test10();
+ test12();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
new file mode 100644
index 00000000000..2596f7a885b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2004 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <istream>
+#include <ostream>
+#include <streambuf>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void test2()
+{
+ bool test __attribute__((unused)) = true;
+ wistringstream stream;
+ stream >> static_cast<wstreambuf*>(NULL);
+ VERIFY( stream.rdstate() & ios_base::failbit );
+}
+
+void test4()
+{
+ bool test __attribute__((unused)) = true;
+ wistringstream stream;
+ stream.exceptions(ios_base::failbit);
+
+ try
+ {
+ stream >> static_cast<wstreambuf*>(NULL);
+ VERIFY( false );
+ }
+ catch (ios_base::failure&)
+ {
+ }
+
+ VERIFY( stream.rdstate() & ios_base::failbit );
+}
+
+// libstdc++/9371
+int main()
+{
+ test2();
+ test4();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/testsuite_io.h b/libstdc++-v3/testsuite/testsuite_io.h
index 14f5cb4d47e..3b81184f171 100644
--- a/libstdc++-v3/testsuite/testsuite_io.h
+++ b/libstdc++-v3/testsuite/testsuite_io.h
@@ -159,20 +159,20 @@ namespace __gnu_test
virtual int_type underflow()
{
throw underflow_error();
- return -1;
+ return int_type();
}
virtual int_type uflow()
{
throw underflow_error();
- return -1;
+ return int_type();
}
virtual int_type
overflow(int_type)
{
throw overflow_error();
- return -1;
+ return int_type();
}
virtual pos_type