summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/objects/wchar_t
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/27_io/objects/wchar_t
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/objects/wchar_t')
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/1.cc100
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc115
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc112
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12.cc122
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc44
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc41
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc44
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc40
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/13.cc119
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/13582-1_xin.cc60
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/13582-1_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/2.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-1_xin.cc88
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-1_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-2_xin.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-2_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/3045.cc77
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/3647.cc37
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/3_xin.cc41
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/3_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/41037.cc35
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/4_xin.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/4_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/5.cc84
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc37
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/5280_xin.cc47
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/5280_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/6.cc49
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/6548_xin.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/6548_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-1_xin.cc37
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-1_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-2_xin.cc34
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-2_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc85
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/7744_xin.cc41
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/7744_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/8.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc58
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc98
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-2_xin.cc47
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-2_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9662.cc41
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9_xin.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/9_xin.in1
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/wchar_t/dr455.cc36
47 files changed, 2107 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/1.cc
new file mode 100644
index 000000000..d05762d89
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/1.cc
@@ -0,0 +1,100 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Include all the headers except for iostream.
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <cwchar>
+#include <cwctype>
+#include <testsuite_hooks.h>
+
+// Include iostream last, just to make is as difficult as possible to
+// properly initialize the standard iostream objects.
+#include <iostream>
+
+// Make sure all the standard streams are defined.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ wchar_t array2[20];
+ typedef std::wios::traits_type wtraits_type;
+ wtraits_type::int_type wi = 15;
+ wtraits_type::copy(array2, L"testing istream", wi);
+ std::wcout << L"testing wcout" << std::endl;
+ std::wcerr << L"testing wcerr" << std::endl;
+ VERIFY( std::wcerr.flags() & std::ios_base::unitbuf );
+ std::wclog << L"testing wclog" << std::endl;
+ // std::wcin >> array2; // requires somebody to type something in.
+ VERIFY( std::wcin.tie() == &std::wcout );
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc
new file mode 100644
index 000000000..1030e75be
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc
@@ -0,0 +1,115 @@
+// { dg-require-namedlocale "se_NO.UTF-8" }
+
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <cstdio>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// Test handling of UTF-8 in wcin
+void test10()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+ const char* name = "tmp_10";
+
+ locale loc(locale("se_NO.UTF-8"));
+ locale::global(loc);
+ wcin.imbue(loc);
+ wcout.imbue(loc);
+
+ const char* e_lit =
+ "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13"
+ "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&"
+ "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2"
+ "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a"
+ "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2"
+ "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99"
+ "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3"
+ "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85"
+ "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4"
+ "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94"
+ "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf"
+ "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0"
+ "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0"
+ "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0"
+ "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0"
+ "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0"
+ "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80"
+ "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80"
+ "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1"
+ "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80"
+ "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80"
+ "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80"
+ "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80"
+ "\xfd\x80\x80\x80\x80\x80";
+ size_t e_size = strlen(e_lit);
+
+ const wchar_t i_lit[] = {
+ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc,
+ 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!',
+ L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+',
+ L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5',
+ L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?',
+ L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85,
+ 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
+ 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100,
+ 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109,
+ 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112,
+ 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9,
+ 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802,
+ 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b,
+ 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814,
+ 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@',
+ 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000,
+ 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000,
+ 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000,
+ 0x20000000, 0x40000000, 0x0
+ };
+ size_t i_size = wcslen(i_lit);
+
+ FILE* file = fopen(name, "w");
+ size_t n = fwrite(e_lit, 1, e_size, file);
+ VERIFY( n == e_size );
+ fclose(file);
+
+ VERIFY( freopen(name, "r", stdin) );
+
+ wchar_t* wbuf = new wchar_t[i_size + 10];
+ wcin.read(wbuf, i_size + 10);
+ n = wcin.gcount();
+ VERIFY( n == i_size );
+ VERIFY( !wmemcmp(wbuf, i_lit, i_size) );
+ VERIFY( wcin.eof() );
+ VERIFY( wcin.fail() );
+ VERIFY( !wcin.bad() );
+ delete[] wbuf;
+}
+
+int main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc
new file mode 100644
index 000000000..7799591f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc
@@ -0,0 +1,112 @@
+// { dg-require-namedlocale "se_NO.UTF-8" }
+
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <cstdio>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// Test handling of UTF-8 in wcout
+void test11()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+ const char* name = "tmp_11";
+
+ locale loc(locale("se_NO.UTF-8"));
+ locale::global(loc);
+ wcin.imbue(loc);
+ wcout.imbue(loc);
+
+ const char* e_lit =
+ "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13"
+ "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&"
+ "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2"
+ "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a"
+ "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2"
+ "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99"
+ "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3"
+ "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85"
+ "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4"
+ "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94"
+ "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf"
+ "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0"
+ "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0"
+ "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0"
+ "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0"
+ "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0"
+ "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80"
+ "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80"
+ "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1"
+ "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80"
+ "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80"
+ "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80"
+ "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80"
+ "\xfd\x80\x80\x80\x80\x80";
+ size_t e_size = strlen(e_lit);
+
+ const wchar_t i_lit[] = {
+ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc,
+ 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!',
+ L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+',
+ L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5',
+ L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?',
+ L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85,
+ 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
+ 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100,
+ 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109,
+ 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112,
+ 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9,
+ 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802,
+ 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b,
+ 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814,
+ 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@',
+ 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000,
+ 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000,
+ 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000,
+ 0x20000000, 0x40000000, 0x0
+ };
+ size_t i_size = wcslen(i_lit);
+
+ VERIFY( freopen(name, "w", stdout) );
+
+ wcout.write(i_lit, i_size);
+ wcout.flush();
+ VERIFY( wcout.good() );
+
+ FILE* file = fopen(name, "r");
+ char* buf = new char[e_size + 10];
+ size_t n = fread(buf, 1, e_size + 10, file);
+ VERIFY( n == e_size );
+ VERIFY( !memcmp(buf, e_lit, e_size) );
+ delete[] buf;
+ fclose(file);
+}
+
+int main()
+{
+ test11();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12.cc
new file mode 100644
index 000000000..e94abdd62
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12.cc
@@ -0,0 +1,122 @@
+// { dg-require-namedlocale "se_NO.UTF-8" }
+
+// 2003-09-04 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <iostream>
+#include <cstdio>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// Test handling of UTF-8 in wcout
+void test12()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+ const char* name = "tmp_12";
+
+ locale loc(locale("se_NO.UTF-8"));
+ locale::global(loc);
+ std::ios_base::sync_with_stdio(false);
+ wcout.imbue(loc);
+
+ const char cstr[] =
+ "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13"
+ "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&"
+ "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2"
+ "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a"
+ "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2"
+ "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99"
+ "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3"
+ "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85"
+ "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4"
+ "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94"
+ "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf"
+ "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0"
+ "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0"
+ "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0"
+ "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0"
+ "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0"
+ "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80"
+ "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80"
+ "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1"
+ "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80"
+ "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80"
+ "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80"
+ "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80"
+ "\xfd\x80\x80\x80\x80\x80";
+
+ const wchar_t wstr[] = {
+ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc,
+ 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!',
+ L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+',
+ L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5',
+ L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?',
+ L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85,
+ 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
+ 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100,
+ 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109,
+ 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112,
+ 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9,
+ 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802,
+ 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b,
+ 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814,
+ 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@',
+ 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000,
+ 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000,
+ 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000,
+ 0x20000000, 0x40000000, 0x0
+ };
+
+ const size_t clen = sizeof(cstr) / sizeof(cstr[0]);
+ const size_t wlen = sizeof(wstr) / sizeof(wstr[0]);
+
+ int fd = open(name,
+ O_WRONLY | O_CREAT | O_TRUNC,
+ 0666);
+ VERIFY( fd != -1 );
+ VERIFY( dup2(fd, 1) == 1 );
+ close(fd);
+
+ wcout.write(wstr, wlen);
+ wcout.flush();
+ VERIFY( wcout.good() );
+
+ FILE* file = fopen(name, "r");
+ char buf[clen + 10];
+ size_t n = fread(buf, 1, clen + 10, file);
+ VERIFY( n == clen );
+ VERIFY( !memcmp(buf, cstr, clen) );
+ fclose(file);
+}
+
+int main()
+{
+ test12();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc
new file mode 100644
index 000000000..58a40ce91
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-1.cc
@@ -0,0 +1,44 @@
+// Derived from libstdc++/12048 by LJR <ljrittle@acm.org> with
+// reminder from Petur Runolfsson <peturr02@ru.is>.
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ wchar_t c1;
+ wchar_t c2;
+ std::wcin.get(c1);
+ std::wcin.unget();
+ std::wcin.get(c2);
+ VERIFY( std::wcin.good() );
+ VERIFY( c1 == c2 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc
new file mode 100644
index 000000000..7eaef212f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-2.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <cstdio>
+#include <cwchar>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ wchar_t c1;
+ std::wint_t c2;
+ std::wcin.get(c1);
+ std::wcin.unget();
+ VERIFY( std::wcin.good() );
+ c2 = std::fgetwc(stdin);
+ VERIFY( c2 == std::char_traits<wchar_t>::to_int_type(c1) );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc
new file mode 100644
index 000000000..8e236ab30
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-3.cc
@@ -0,0 +1,44 @@
+// Derived from libstdc++/12048 by LJR <ljrittle@acm.org> with
+// reminder from Petur Runolfsson <peturr02@ru.is>.
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <cwchar>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ wchar_t buf[2];
+ VERIFY( std::wcin.rdbuf()->sgetn(buf, 2) == 2 );
+ std::wint_t c1 = std::wcin.rdbuf()->sungetc();
+ std::wint_t c2 = std::wcin.rdbuf()->sbumpc();
+ VERIFY( c1 == std::char_traits<wchar_t>::to_int_type(buf[1]) );
+ VERIFY( c2 == c1 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc
new file mode 100644
index 000000000..3649e7e22
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-4.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <cstdio>
+#include <cwchar>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ wchar_t buf[2];
+ VERIFY( std::wcin.rdbuf()->sgetn(buf, 2) == 2 );
+ wint_t c1 = std::wcin.rdbuf()->sungetc();
+ wint_t c2 = std::fgetwc(stdin);
+ VERIFY( c1 == std::char_traits<wchar_t>::to_int_type(buf[1]) );
+ VERIFY( c2 == c1 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc
new file mode 100644
index 000000000..49486e3c4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12048-5.cc
@@ -0,0 +1,52 @@
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// DR 49 states that cin.rdbuf()->sbumpc() and fgetc(stdin) should be
+// equivalent and interchangable. Currently however, cin.rdbuf()->sungetc()
+// only returns characters that were read with cin.rdbuf()->sbumpc()
+
+// { dg-do run { xfail *-*-* } }
+
+#include <iostream>
+#include <cstdio>
+#include <cwchar>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ VERIFY( std::freopen("cin_unget-1.txt", "r", stdin) );
+
+ wchar_t c1;
+ std::wint_t c2;
+ wchar_t c3;
+ std::wcin.get(c1);
+ c2 = std::fgetwc(stdin);
+ std::wcin.unget();
+ if (std::wcin.good())
+ {
+ std::wcin.get(c3);
+ VERIFY( std::wcin.good() );
+ VERIFY( c3 == std::char_traits<wchar_t>::to_char_type(c2) );
+ }
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/13.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/13.cc
new file mode 100644
index 000000000..43b660246
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/13.cc
@@ -0,0 +1,119 @@
+// { dg-require-namedlocale "se_NO.UTF-8" }
+
+// 2003-09-04 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <iostream>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+// Test handling of UTF-8 in wcin
+void test13()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+ const char* name = "tmp_13";
+
+ locale loc(locale("se_NO.UTF-8"));
+ locale::global(loc);
+ std::ios_base::sync_with_stdio(false);
+ wcin.imbue(loc);
+
+ const char cstr[] =
+ "\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13"
+ "\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20!\"#$%&"
+ "'()*+,-./0123456789:;<=>?@}~\x7f\xc2\x80\xc2\x81\xc2\x82\xc2"
+ "\x83\xc2\x84\xc2\x85\xc2\x86\xc2\x87\xc2\x88\xc2\x89\xc2\x8a"
+ "\xc2\x8b\xc2\x8c\xc2\x8d\xc2\x8e\xc2\x8f\xc2\x90\xc2\x91\xc2"
+ "\x92\xc2\x93\xc2\x94\xc2\x95\xc2\x96\xc2\x97\xc2\x98\xc2\x99"
+ "\xc2\x9a\xc2\x9b\xc2\x9c\xc3\xba\xc3\xbb\xc3\xbc\xc3\xbd\xc3"
+ "\xbe\xc3\xbf\xc4\x80\xc4\x81\xc4\x82\xc4\x83\xc4\x84\xc4\x85"
+ "\xc4\x86\xc4\x87\xc4\x88\xc4\x89\xc4\x8a\xc4\x8b\xc4\x8c\xc4"
+ "\x8d\xc4\x8e\xc4\x8f\xc4\x90\xc4\x91\xc4\x92\xc4\x93\xc4\x94"
+ "\xc4\x95\xc4\x96\xc4\x97\xc4\x98\xc4\x99\xdf\xb8\xdf\xb9\xdf"
+ "\xba\xdf\xbb\xdf\xbc\xdf\xbd\xdf\xbe\xdf\xbf\xe0\xa0\x80\xe0"
+ "\xa0\x81\xe0\xa0\x82\xe0\xa0\x83\xe0\xa0\x84\xe0\xa0\x85\xe0"
+ "\xa0\x86\xe0\xa0\x87\xe0\xa0\x88\xe0\xa0\x89\xe0\xa0\x8a\xe0"
+ "\xa0\x8b\xe0\xa0\x8c\xe0\xa0\x8d\xe0\xa0\x8e\xe0\xa0\x8f\xe0"
+ "\xa0\x90\xe0\xa0\x91\xe0\xa0\x92\xe0\xa0\x93\xe0\xa0\x94\xe0"
+ "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80"
+ "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80"
+ "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1"
+ "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80"
+ "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80"
+ "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80"
+ "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80"
+ "\xfd\x80\x80\x80\x80\x80";
+
+ const wchar_t wstr[] = {
+ 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc,
+ 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, L'!',
+ L'"', L'#', L'$', L'%', L'&', L'\'', L'(', L')', L'*', L'+',
+ L',', L'-', L'.', L'/', L'0', L'1', L'2', L'3', L'4', L'5',
+ L'6', L'7', L'8', L'9', L':', L';', L'<', L'=', L'>', L'?',
+ L'@', L'}', L'~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85,
+ 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
+ 0x9a, 0x9b, 0x9c, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x100,
+ 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109,
+ 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, 0x110, 0x111, 0x112,
+ 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x7f8, 0x7f9,
+ 0x7fa, 0x7fb, 0x7fc, 0x7fd, 0x7fe, 0x7ff, 0x800, 0x801, 0x802,
+ 0x803, 0x804, 0x805, 0x806, 0x807, 0x808, 0x809, 0x80a, 0x80b,
+ 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814,
+ 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@',
+ 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000,
+ 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000,
+ 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000,
+ 0x20000000, 0x40000000, 0x0
+ };
+
+ const size_t clen = sizeof(cstr) / sizeof(cstr[0]);
+ const size_t wlen = sizeof(wstr) / sizeof(wstr[0]);
+
+ FILE* file = fopen(name, "w");
+ fwrite(cstr, 1, clen, file);
+ fclose(file);
+
+ int fd = open(name, O_RDONLY);
+ dup2(fd, 0);
+ close(fd);
+
+ wchar_t wbuf[wlen + 10];
+ wcin.read(wbuf, wlen + 10);
+ streamsize n = wcin.gcount();
+ VERIFY( n == static_cast<streamsize>(wlen) );
+ VERIFY( !wmemcmp(wbuf, wstr, wlen) );
+ VERIFY( wcin.eof() );
+ VERIFY( wcin.fail() );
+ VERIFY( !wcin.bad() );
+}
+
+int main()
+{
+ test13();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/13582-1_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/13582-1_xin.cc
new file mode 100644
index 000000000..44a6ca5b8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/13582-1_xin.cc
@@ -0,0 +1,60 @@
+// 2004-01-11 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <string>
+#include <locale>
+
+// libstdc++/13582
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ ios_base::sync_with_stdio(false);
+ wcout << "Type in 12345\n";
+
+ wstring str;
+ wchar_t c;
+
+ if (wcin.get(c) && !isspace(c, wcin.getloc()))
+ {
+ str.push_back(c);
+ wcin.imbue(locale("en_US"));
+ }
+
+ if (wcin.get(c) && !isspace(c, wcin.getloc()))
+ {
+ str.push_back(c);
+ wcin.imbue(locale("fr_FR"));
+ }
+
+ while (wcin.get(c) && !isspace(c, wcin.getloc()))
+ {
+ str.push_back(c);
+ }
+
+ wcout << str << endl;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/13582-1_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/13582-1_xin.in
new file mode 100644
index 000000000..e56e15bb7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/13582-1_xin.in
@@ -0,0 +1 @@
+12345
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2.cc
new file mode 100644
index 000000000..b5b8c4e7c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2.cc
@@ -0,0 +1,46 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// Interactive test, to be exercised as follows:
+// assign stderr to stdout in shell command line,
+// pipe stdout to cat process and/or redirect stdout to file.
+// a.out >& output
+// "hello fine world\n" should be written to stdout, and output, in
+// proper order. This is a version of the scott snyder test taken
+// from: http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00108.html
+void test04()
+{
+ using namespace std;
+
+ wcout << L"hello ";
+ wcout.flush();
+ wcerr << L"fine ";
+ wcerr.flush();
+ wcout << L"world" << endl;
+ wcout.flush();
+}
+
+int
+main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-1_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-1_xin.cc
new file mode 100644
index 000000000..d423ceb30
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-1_xin.cc
@@ -0,0 +1,88 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Include all the headers except for iostream.
+#include <algorithm>
+#include <bitset>
+#include <complex>
+#include <deque>
+#include <exception>
+#include <fstream>
+#include <functional>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#include <memory>
+#include <new>
+#include <numeric>
+#include <ostream>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <typeinfo>
+#include <utility>
+#include <valarray>
+#include <vector>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfloat>
+#include <ciso646>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <testsuite_hooks.h>
+
+// Include iostream last, just to make is as difficult as possible to
+// properly initialize the standard iostream objects.
+#include <iostream>
+
+// libstdc++/2523
+void test02()
+{
+ using namespace std;
+ int i;
+ wcin >> i;
+ wcout << "i == " << i << endl;
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-1_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-1_xin.in
new file mode 100644
index 000000000..ec308096e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-1_xin.in
@@ -0,0 +1 @@
+5588885
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-2_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-2_xin.cc
new file mode 100644
index 000000000..2697e78e5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-2_xin.cc
@@ -0,0 +1,38 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// libstdc++/2523
+void test03()
+{
+ using namespace std;
+ ios_base::sync_with_stdio(false);
+
+ int i;
+ wcin >> i;
+ wcout << "i == " << i << endl;
+}
+
+int
+main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-2_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-2_xin.in
new file mode 100644
index 000000000..aaee5e562
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/2523-2_xin.in
@@ -0,0 +1 @@
+33332
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/3045.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/3045.cc
new file mode 100644
index 000000000..9cec1b143
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/3045.cc
@@ -0,0 +1,77 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <fstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+class gnu_filebuf: public std::wfilebuf
+{
+ int i;
+public:
+ gnu_filebuf(int j = 1): i(j) { }
+ ~gnu_filebuf() { --i; }
+ int get_i() { return i;}
+};
+
+const int initial = 4;
+gnu_filebuf buf(initial);
+
+// libstdc++/3045, in a vague way.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ int k1;
+
+ // 1 normal
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+ {
+ std::wcout.rdbuf(&buf);
+ }
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+
+ // 2 syncd off
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+ {
+ std::wcout.rdbuf(&buf);
+ std::ios_base::sync_with_stdio(false); // make sure doesn't clobber buf
+ }
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+
+ // 3 callling init
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+ {
+ std::wcout.rdbuf(&buf);
+ std::ios_base::Init make_sure_initialized;
+ }
+ k1 = buf.get_i();
+ VERIFY( k1 == initial );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/3647.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/3647.cc
new file mode 100644
index 000000000..1aff3f74b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/3647.cc
@@ -0,0 +1,37 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// 27.6.1.5 - Template class basic_iostream
+// NB: This file is for testing iostream with NO OTHER INCLUDES.
+
+#include <iostream>
+
+// libstdc++/3647
+void test07()
+{
+ // Should not block.
+ std::wcout << std::wcin.rdbuf()->in_avail() << std::endl;
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/3_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/3_xin.cc
new file mode 100644
index 000000000..c481373be
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/3_xin.cc
@@ -0,0 +1,41 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// Interactive test, to be exercised as follows:
+// run test under truss(1) or strace(1). Look at
+// size and pattern of write system calls.
+// Should be 2 or 3 write(1,[...]) calls when run interactively
+// depending upon buffering mode enforced.
+void test05()
+{
+ std::wcout << L"hello" << L' ' << L"world" << std::endl;
+ std::wcout << L"Enter your name: ";
+ std::wstring s;
+ std::wcin >> s;
+ std::wcout << L"hello " << s << std::endl;
+}
+
+int
+main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/3_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/3_xin.in
new file mode 100644
index 000000000..a26c12687
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/3_xin.in
@@ -0,0 +1 @@
+JOHN HUME and DAVID TRIMBLE
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/41037.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/41037.cc
new file mode 100644
index 000000000..b3c01a0b7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/41037.cc
@@ -0,0 +1,35 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// PR libstdc++/41037
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( std::wcerr.flags() & std::ios_base::dec );
+ VERIFY( std::wcerr.flags() & std::ios_base::skipws );
+ VERIFY( std::wcerr.flags() & std::ios_base::unitbuf );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/4_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/4_xin.cc
new file mode 100644
index 000000000..0e4f9ca18
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/4_xin.cc
@@ -0,0 +1,38 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// http://gcc.gnu.org/ml/libstdc++/2002-08/msg00060.html
+// Should only have to hit enter once.
+void
+test10()
+{
+ using namespace std;
+ wcout << L"Press ENTER once\n";
+ wcin.ignore(1);
+ wcout << L"_M_gcount: " << wcin.gcount() << endl;
+}
+
+int
+main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/4_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/4_xin.in
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/4_xin.in
@@ -0,0 +1 @@
+
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/5.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5.cc
new file mode 100644
index 000000000..4bafef34e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5.cc
@@ -0,0 +1,84 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2009 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 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.3 Standard iostream objects
+
+// Check that standard streams can be used from constructors and
+// destructors of static objects, provided that an instance of
+// ios_base::Init has been constructed.
+
+void init_standard_streams();
+int use_standard_streams();
+
+struct Strange
+{
+ int i;
+
+ Strange()
+ {
+ init_standard_streams();
+ i = use_standard_streams();
+ }
+
+ ~Strange()
+ {
+ use_standard_streams();
+ init_standard_streams();
+ }
+};
+
+static Strange static_ob;
+
+#include <testsuite_hooks.h>
+#include <iostream>
+
+void init_standard_streams()
+{
+ std::ios_base::Init init;
+}
+
+int use_standard_streams()
+{
+ std::wcout << L"Hello, world!" << std::endl;
+ std::wcerr << L"World, hello!" << std::endl;
+
+ int ret = std::ios_base::xalloc();
+ std::wcin.iword(ret) = ret + 1;
+ std::wcout.iword(ret) = ret + 2;
+ std::wcerr.iword(ret) = ret + 3;
+ std::wclog.iword(ret) = ret + 4;
+ return ret;
+}
+
+void test05()
+{
+ bool test __attribute__((unused)) = true;
+ int i = static_ob.i;
+
+ VERIFY( std::wcin.iword(i) == i + 1 );
+ VERIFY( std::wcout.iword(i) == i + 2 );
+ VERIFY( std::wcerr.iword(i) == i + 3 );
+ VERIFY( std::wclog.iword(i) == i + 4 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc
new file mode 100644
index 000000000..04571cc63
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5268.cc
@@ -0,0 +1,37 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2001, 2002, 2003, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <sstream>
+#include <iostream>
+
+// libstdc++/5268
+void test04()
+{
+ std::wstringbuf b1;
+ std::wcout.rdbuf( &b1 );
+ std::wcout << L"hello\n";
+ std::wcout.rdbuf(0);
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/5280_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5280_xin.cc
new file mode 100644
index 000000000..18d33855f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5280_xin.cc
@@ -0,0 +1,47 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// libstdc++/5280
+// Interactive test: input "1234^D^D" for i should terminate for EOF.
+void test06()
+{
+ using namespace std;
+ int i;
+ wcin >> i;
+ if (!wcin.good())
+ {
+ wcerr << endl;
+ wcerr << L"i == " << i << endl;
+ wcerr << L"wcin.rdstate() == " << wcin.rdstate() << endl;
+ wcerr << L"wcin.bad() == " << wcin.bad() << endl;
+ wcerr << L"wcin.fail() == " << wcin.fail() << endl;
+ wcerr << L"wcin.eof() == " << wcin.eof() << endl;
+ }
+ else
+ wcerr << L"i == " << i << endl;
+}
+
+int
+main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/5280_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5280_xin.in
new file mode 100644
index 000000000..81c545efe
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/5280_xin.in
@@ -0,0 +1 @@
+1234
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/6.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6.cc
new file mode 100644
index 000000000..d3de3e899
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6.cc
@@ -0,0 +1,49 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2009 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 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.3 Standard iostream objects
+
+// ios_base::Init::~Init() calls wcout.flush(), which may call
+// wcout.setstate(badbit), which may throw an exception. Check that
+// the exception doesn't escape from the destructor.
+
+#include <iostream>
+#include <streambuf>
+
+class Badbuf : public std::wstreambuf
+{
+protected:
+ virtual int sync()
+ {
+ return -1;
+ }
+};
+
+void test06()
+{
+ std::ios_base::Init init;
+ std::wcout.rdbuf(new Badbuf);
+ std::wcout.exceptions(std::ios_base::badbit);
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/6548_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6548_xin.cc
new file mode 100644
index 000000000..1a6588681
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6548_xin.cc
@@ -0,0 +1,38 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/6548
+void test07()
+{
+ bool test __attribute__((unused)) = true;
+ std::wcout << L"Enter 'test':";
+ std::wstring s;
+ std::getline(std::wcin, s, L'\n');
+ VERIFY( s == L"test" );
+}
+
+int
+main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/6548_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6548_xin.in
new file mode 100644
index 000000000..9daeafb98
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6548_xin.in
@@ -0,0 +1 @@
+test
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-1_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-1_xin.cc
new file mode 100644
index 000000000..5a3adf410
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-1_xin.cc
@@ -0,0 +1,37 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+// libstdc++/6648
+// Interactive tests: each one (run alone) must terminate upon a single '\n'.
+void test08()
+{
+ bool test __attribute__((unused)) = true;
+ wchar_t buff[2048];
+ std::wcout << "Enter name: ";
+ std::wcin.getline(buff, 2048);
+}
+
+int
+main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-1_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-1_xin.in
new file mode 100644
index 000000000..9dd5f1f2e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-1_xin.in
@@ -0,0 +1 @@
+Kofi A. Annan
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-2_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-2_xin.cc
new file mode 100644
index 000000000..7f89a035b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-2_xin.cc
@@ -0,0 +1,34 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+
+void test09()
+{
+ bool test __attribute__((unused)) = true;
+ std::wcout << L"Enter favorite beach: ";
+ std::wcin.ignore(2048, '\n');
+}
+
+int
+main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-2_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-2_xin.in
new file mode 100644
index 000000000..0b2c7cf28
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/6648-2_xin.in
@@ -0,0 +1 @@
+Oak St. Beach, Chicago
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc
new file mode 100644
index 000000000..33e74617a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7.cc
@@ -0,0 +1,85 @@
+// { dg-require-fork "" }
+// { dg-require-mkfifo "" }
+
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.3 Standard iostream objects
+
+#include <fstream>
+#include <iostream>
+#include <cstdlib>
+#include <unistd.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+// No asserts, avoid leaking the semaphore if a VERIFY fails.
+#undef _GLIBCXX_ASSERT
+
+#include <testsuite_hooks.h>
+
+// Check that wcout.flush() is called when last ios_base::Init is destroyed.
+bool test07()
+{
+ using namespace std;
+ using namespace __gnu_test;
+ bool test __attribute__((unused)) = true;
+
+ const char* name = "tmp_fifo4";
+
+ signal(SIGPIPE, SIG_IGN);
+
+ unlink(name);
+ mkfifo(name, S_IRWXU);
+ semaphore s1;
+
+ int child = fork();
+ VERIFY( child != -1 );
+
+ if (child == 0)
+ {
+ wfilebuf fbout;
+ fbout.open(name, ios_base::out);
+ s1.wait();
+ wcout.rdbuf(&fbout);
+ fbout.sputc(L'a');
+ // NB: fbout is *not* destroyed here!
+ exit(0);
+ }
+
+ wfilebuf fbin;
+ fbin.open(name, ios_base::in);
+ s1.signal();
+ wfilebuf::int_type c = fbin.sbumpc();
+ VERIFY( c != wfilebuf::traits_type::eof() );
+ VERIFY( c == wfilebuf::traits_type::to_int_type(L'a') );
+
+ fbin.close();
+
+ return test;
+}
+
+int
+main()
+{
+ return !test07();
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/7744_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7744_xin.cc
new file mode 100644
index 000000000..839adae5f
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7744_xin.cc
@@ -0,0 +1,41 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// libstdc++/7744
+void test11()
+{
+ bool test __attribute__((unused)) = true;
+ std::ios::sync_with_stdio(false);
+
+ std::wcout << "Type in the characters 'abc' and press <ENTER>: ";
+ std::wcin.peek();
+
+ // The number of unread characters should be 4 (a, b, c, \\n)
+ VERIFY( 4 == std::wcin.rdbuf()->in_avail() );
+}
+
+int
+main()
+{
+ test11();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/7744_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7744_xin.in
new file mode 100644
index 000000000..8baef1b4a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/7744_xin.in
@@ -0,0 +1 @@
+abc
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/8.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/8.cc
new file mode 100644
index 000000000..852a020f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/8.cc
@@ -0,0 +1,50 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2009 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 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+ // 27.3 - Standard iostream objects p 2
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ // 27.3 - Standard iostream objects p 2
+ // The objects are not destroyed during program execution.
+ void* p1 = &std::wcout;
+ void* p2 = &std::wcin;
+ void* p3 = &std::wcerr;
+ void* p4 = &std::wclog;
+ std::ios_base::sync_with_stdio(false);
+ void* p1s = &std::wcout;
+ void* p2s = &std::wcin;
+ void* p3s = &std::wcerr;
+ void* p4s = &std::wclog;
+ VERIFY( p1 == p1s );
+ VERIFY( p2 == p2s );
+ VERIFY( p3 == p3s );
+ VERIFY( p4 == p4s );
+}
+
+int main(void)
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc
new file mode 100644
index 000000000..717bbc12a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9520.cc
@@ -0,0 +1,58 @@
+// { dg-require-namedlocale "de_DE.ISO-8859-15@euro" }
+
+// 2003-04-30 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_hooks.h>
+#include <iostream>
+#include <cstdio>
+
+void test01()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+ const char* name = "tmp_9520";
+
+ FILE* file = fopen(name, "w");
+ for (int i = 1; i < 256; ++i)
+ putc(static_cast<unsigned char>(i), file);
+ fclose(file);
+
+ locale loc (locale("de_DE.ISO-8859-15@euro"));
+ locale::global(loc); // Set locale for stdin
+
+ VERIFY( freopen(name, "r", stdin) );
+
+ wcin.imbue(loc);
+
+ for (int j = 1; j < 256; ++j)
+ {
+ wint_t c1 = wcin.rdbuf()->sgetc();
+ VERIFY( c1 != WEOF );
+ wint_t c2 = wcin.rdbuf()->sbumpc();
+ VERIFY( c1 == c2 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
new file mode 100644
index 000000000..ca470dac9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-1.cc
@@ -0,0 +1,98 @@
+// { dg-require-fork "" }
+// { dg-require-mkfifo "" }
+
+// 2003-04-30 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// No asserts, avoid leaking the semaphores if a VERIFY fails.
+#undef _GLIBCXX_ASSERT
+
+#include <testsuite_hooks.h>
+#include <cstdio>
+#include <cstdlib>
+#include <iostream>
+#include <unistd.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+// Check that wcin.rdbuf()->sputbackc() puts characters back to stdin.
+// If wcin.rdbuf() is a filebuf, this succeeds when stdin is a regular
+// file, but fails otherwise, hence the named fifo.
+bool test01()
+{
+ using namespace std;
+ using namespace __gnu_test;
+
+ bool test __attribute__((unused)) = true;
+
+ const char* name = "tmp_fifo5";
+
+ signal(SIGPIPE, SIG_IGN);
+
+ unlink(name);
+ mkfifo(name, S_IRWXU);
+ semaphore s1, s2;
+
+ int child = fork();
+ VERIFY( child != -1 );
+
+ if (child == 0)
+ {
+ FILE* file = fopen(name, "w");
+ fputs("Whatever\n", file);
+ fflush(file);
+ s1.signal();
+ s2.wait();
+ fclose(file);
+ s1.signal();
+ exit(0);
+ }
+
+ VERIFY( freopen(name, "r", stdin) );
+ s1.wait();
+
+ wint_t c1 = fgetwc(stdin);
+ VERIFY( c1 != WEOF );
+ wint_t c2 = wcin.rdbuf()->sputbackc(L'a');
+ VERIFY( c2 != WEOF );
+ VERIFY( c2 == L'a' );
+
+ wint_t c3 = fgetwc(stdin);
+ VERIFY( c3 != WEOF );
+ VERIFY( c3 == c2 );
+ wint_t c4 = ungetwc(L'b', stdin);
+ VERIFY( c4 != WEOF );
+ VERIFY( c4 == L'b' );
+
+ wint_t c5 = wcin.rdbuf()->sgetc();
+ VERIFY( c5 != WEOF );
+ VERIFY( c5 == c4 );
+ s2.signal();
+ s1.wait();
+
+ return test;
+}
+
+int main()
+{
+ return !test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-2_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-2_xin.cc
new file mode 100644
index 000000000..ee3732b2e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-2_xin.cc
@@ -0,0 +1,47 @@
+// 2003-04-30 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_hooks.h>
+#include <cstdio>
+#include <iostream>
+#include <cwchar>
+
+void test02()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+
+ wint_t c1 = fgetwc(stdin);
+ wint_t c2 = wcin.rdbuf()->sputbackc(c1);
+ VERIFY( c2 == c1 );
+
+ wint_t c3 = fgetwc(stdin);
+ VERIFY( c3 == c1 );
+ ungetwc(c3, stdin);
+
+ wint_t c4 = wcin.rdbuf()->sgetc();
+ VERIFY( c4 == c3 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-2_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-2_xin.in
new file mode 100644
index 000000000..ad9013028
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9661-2_xin.in
@@ -0,0 +1 @@
+For what you dream of
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9662.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9662.cc
new file mode 100644
index 000000000..425f7db75
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9662.cc
@@ -0,0 +1,41 @@
+// 2003-04-30 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_hooks.h>
+#include <iostream>
+#include <cstdio>
+#include <cwchar>
+
+// Check that operations on wcout can be mixed with wide operations
+// on stdout.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wcout << L"Hello, ";
+ VERIFY( std::fwide(stdout, 0) >= 0 );
+ int ret = std::fputws(L"world!\n", stdout);
+ VERIFY( ret >= 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9_xin.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9_xin.cc
new file mode 100644
index 000000000..a57c3afc7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9_xin.cc
@@ -0,0 +1,64 @@
+// 2003-05-01 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <locale>
+#include <string>
+#include <cwchar>
+#include <cwctype>
+#include <iterator>
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+// This tests the handling of multibyte characters by wcin and wcout.
+void test09()
+{
+ using namespace std;
+
+ locale loc("");
+ locale::global(loc);
+
+ wcout.imbue(loc);
+ wcin.imbue(loc);
+
+ wcout << L"Current locale is: \'" << loc.name().c_str() << L"\'\n";
+ wcout << L"Please enter your name: ";
+
+ wstring str;
+ getline(wcin, str);
+
+ wcout << str << endl;
+ wcout << str.size() << endl;
+
+ transform(str.begin(), str.end(),
+ ostream_iterator<wchar_t, wchar_t>(wcout), towupper);
+ wcout << endl;
+ transform(str.begin(), str.end(),
+ ostream_iterator<wchar_t, wchar_t>(wcout), towlower);
+ wcout << endl << hex << showbase;
+ copy(str.begin(), str.end(),
+ ostream_iterator<wint_t, wchar_t>(wcout, L" "));
+ wcout << endl;
+}
+
+int main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/9_xin.in b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9_xin.in
new file mode 100644
index 000000000..a26c12687
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/9_xin.in
@@ -0,0 +1 @@
+JOHN HUME and DAVID TRIMBLE
diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/dr455.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/dr455.cc
new file mode 100644
index 000000000..8055d967b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/dr455.cc
@@ -0,0 +1,36 @@
+// 2006-03-08 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// DR 455. cerr::tie() and wcerr::tie() are overspecified.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( std::wcerr.tie() == &std::wcout );
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}