summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/basic_ios
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/basic_ios')
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc68
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/cons/2020.cc54
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/cons/char/1.cc79
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/cons/char/2.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/cons/char/3.cc169
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc66
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc76
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/2.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/imbue/14072.cc83
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc52
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/requirements/base_classes.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/requirements/explicit_instantiation.cc31
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/requirements/typedefs.cc37
14 files changed, 937 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc
new file mode 100644
index 000000000..b65d08900
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/clear/char/1.cc
@@ -0,0 +1,68 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999, 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/>.
+
+
+// 27.4.4.2 basic_ios member functions
+
+// NB: Don't include any other headers in this file.
+#include <ios>
+#include <testsuite_hooks.h>
+
+// 27.4.4.3 basic_ios iostate flags function
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::ios_base::fmtflags fmtflags;
+ typedef std::ios_base::iostate iostate;
+ using std::ios_base;
+
+ iostate iostate02, iostate03;
+ const iostate iostate01 = std::ios_base::badbit | std::ios_base::eofbit;
+ std::ios ios_01(0);
+
+ // bool fail() const
+ VERIFY( ios_01.fail() );
+
+ // bool operator!() const
+ VERIFY( !ios_01 );
+
+ // iostate rdstate() const
+ iostate03 = ios_01.rdstate();
+ VERIFY( static_cast<bool>(iostate03 & std::ios_base::badbit) );
+
+ // void clear(iostate state = goodbit)
+ try {
+ ios_01.clear(std::ios_base::eofbit);
+ iostate02 = ios_01.rdstate();
+ VERIFY( static_cast<bool>(iostate02 & iostate01) );
+ }
+ catch(std::ios_base::failure& fail) {
+ VERIFY( false );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/cons/2020.cc b/libstdc++-v3/testsuite/27_io/basic_ios/cons/2020.cc
new file mode 100644
index 000000000..31f712166
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/cons/2020.cc
@@ -0,0 +1,54 @@
+// 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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/>.
+
+// 27.8.1.1 - Template class basic_filebuf
+// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES.
+
+#include <ios>
+#include <testsuite_hooks.h>
+#include <testsuite_character.h>
+
+// libstdc++/2020
+// should be able to use custom char_type, custom traits type
+class gnu_ios: public std::basic_ios<__gnu_test::pod_ushort>
+{ };
+
+void test07()
+{
+ bool test __attribute__((unused)) = true;
+
+ try
+ { gnu_ios obj; }
+ catch(std::exception& obj)
+ {
+ test = false;
+ VERIFY( test );
+ }
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
+
+
+
+// more surf!!!
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/1.cc
new file mode 100644
index 000000000..0796ecfa5
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/1.cc
@@ -0,0 +1,79 @@
+// 1999-07-23 bkoz
+
+// Copyright (C) 1999, 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.4.4.1 basic_ios constructors
+
+#include <ios>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::string str_01("jade cove, big sur");
+ std::string str_05;
+ std::stringbuf strb_01;
+ std::stringbuf strb_02(str_01, std::ios_base::in);
+ std::stringbuf strb_03(str_01, std::ios_base::out);
+ const std::ios_base::fmtflags flag01 = std::ios_base::skipws |
+ std::ios_base::dec;
+ std::ios_base::fmtflags flag02;
+ const std::locale glocale = std::locale();
+
+ // explicit basic_ios(streambuf* sb)
+ std::ios ios_00(0);
+ std::ios ios_01(&strb_01);
+ std::ios ios_02(&strb_02);
+ std::ios ios_03(&strb_03);
+
+ // basic_ios()
+ // NB: This is protected so need to go through fstream
+
+ // void init(sreambuf* sb)
+ // NB: This is protected so need to go through fstream/stringstream
+ // Can double-check the accuracy of the above initializations though.
+ VERIFY( ios_00.rdbuf() == 0 );
+ VERIFY( ios_00.tie() == 0 );
+ VERIFY( ios_00.rdstate() == std::ios_base::badbit );
+ VERIFY( ios_00.exceptions() == std::ios_base::goodbit );
+ flag02 = ios_00.flags();
+ VERIFY( flag02 == flag01 );
+ VERIFY( ios_00.width() == 0 );
+ VERIFY( ios_00.precision() == 6 );
+ VERIFY( ios_00.fill() == ios_00.widen(' ') );
+ VERIFY( ios_00.getloc() == glocale );
+
+ VERIFY( ios_01.rdbuf() == &strb_01 );
+ VERIFY( ios_01.tie() == 0 );
+ VERIFY( ios_01.rdstate() == std::ios_base::goodbit );
+ VERIFY( ios_01.exceptions() == std::ios_base::goodbit );
+ flag02 = ios_01.flags();
+ VERIFY( flag02 == flag01 );
+ VERIFY( ios_01.width() == 0 );
+ VERIFY( ios_01.precision() == 6 );
+ VERIFY( ios_01.fill() == ios_01.widen(' ') );
+ VERIFY( ios_01.getloc() == glocale );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/2.cc
new file mode 100644
index 000000000..d498936f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/2.cc
@@ -0,0 +1,52 @@
+// 2001-06-05 Benjamin Kosnik <bkoz@redhat.com>
+
+// 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/>.
+
+
+// 27.4.2.1.6 class ios_base::init
+
+#include <ios>
+#include <testsuite_hooks.h>
+
+// Non-required instantiations don't have the required facets inbued,
+// by default, into the locale object.
+// See 27.4.4.1
+class gnu_ios: public std::basic_ios<char> { };
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ // 01: Doesn't call basic_ios::init, which uses ctype<char_type>..
+ // This should be unambiguously correct.
+ try
+ {
+ gnu_ios gios;
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/3.cc b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/3.cc
new file mode 100644
index 000000000..bcbe8b737
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/cons/char/3.cc
@@ -0,0 +1,169 @@
+// 2001-06-05 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 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.4.2.1.6 class ios_base::init
+
+#include <sstream>
+#include <typeinfo>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// char_traits specialization
+namespace std
+{
+ template<>
+ struct char_traits<unsigned short>
+ {
+ typedef unsigned short char_type;
+ // Unsigned as wint_t in unsigned.
+ typedef unsigned long int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static void
+ assign(char_type& __c1, const char_type& __c2)
+ { __c1 = __c2; }
+
+ static bool
+ eq(const char_type& __c1, const char_type& __c2)
+ { return __c1 == __c2; }
+
+ static bool
+ lt(const char_type& __c1, const char_type& __c2)
+ { return __c1 < __c2; }
+
+ static int
+ compare(const char_type* __s1, const char_type* __s2, size_t __n)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ if (!eq(__s1[__i], __s2[__i]))
+ return lt(__s1[__i], __s2[__i]) ? -1 : 1;
+ return 0;
+ }
+
+ static size_t
+ length(const char_type* __s)
+ {
+ const char_type* __p = __s;
+ while (__p)
+ ++__p;
+ return (__p - __s);
+ }
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a)
+ {
+ for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
+ if (*__p == __a) return __p;
+ return 0;
+ }
+
+ static char_type*
+ move(char_type* __s1, const char_type* __s2, size_t __n)
+ { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
+
+ static char_type*
+ copy(char_type* __s1, const char_type* __s2, size_t __n)
+ { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
+
+ static char_type*
+ assign(char_type* __s, size_t __n, char_type __a)
+ {
+ for (char_type* __p = __s; __p < __s + __n; ++__p)
+ assign(*__p, __a);
+ return __s;
+ }
+
+ static char_type
+ to_char_type(const int_type&)
+ { return char_type(); }
+
+ static int_type
+ to_int_type(const char_type&) { return int_type(); }
+
+ static bool
+ eq_int_type(const int_type& __c1, const int_type& __c2)
+ { return __c1 == __c2; }
+
+ static int_type
+ eof() { return static_cast<int_type>(-1); }
+
+ static int_type
+ not_eof(const int_type& __c)
+ { return eq_int_type(__c, eof()) ? int_type(0) : __c; }
+ };
+} // namespace std
+
+// Non-required instantiations don't have the required facets inbued,
+// by default, into the locale object.
+// See 27.4.4.1
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ // 02: Calls basic_ios::init, which may call ctype<char_type>...
+ try
+ {
+ std::basic_string<unsigned short> str;
+ std::basic_ostringstream<unsigned short> oss(str);
+
+ // Try each member functions for unformatted io.
+ // put
+ oss.put(324);
+
+ // write
+ const unsigned short us[4] = {1246, 433, 520, 0};
+ oss.write(us, 4);
+
+ // flush
+ oss.flush();
+ }
+ catch(const std::bad_cast& obj)
+ {
+ // Should be able to do the above without calling fill() and
+ // forcing a call to widen...
+ test = false;
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+}
+
+#if !__GXX_WEAK__
+// Explicitly instantiate for systems with no COMDAT or weak support.
+template
+ const std::basic_string<unsigned short>::size_type
+ std::basic_string<unsigned short>::_Rep::_S_max_size;
+
+template
+ const unsigned short
+ std::basic_string<unsigned short>::_Rep::_S_terminal;
+#endif
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
new file mode 100644
index 000000000..0cf07f212
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
@@ -0,0 +1,74 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999, 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/>.
+
+
+// 27.4.4.2 basic_ios member functions
+
+// NB: Don't include any other headers in this file.
+#include <ios>
+#include <testsuite_hooks.h>
+
+// 27.4.4.3 basic_ios iostate flags function
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::ios_base::fmtflags fmtflags;
+ typedef std::ios_base::iostate iostate;
+ using std::ios_base;
+
+ // basic_ios& copyfmt(const basic_ios& rhs)
+ {
+ std::ios ios_01(0);
+ std::ios ios_02(0);
+ ios_01.exceptions(std::ios_base::eofbit);
+ ios_02.exceptions(std::ios_base::eofbit);
+
+ try {
+ ios_01.copyfmt(ios_02);
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+ }
+
+ {
+ std::ios ios_01(0);
+ std::ios ios_02(0);
+ ios_01.clear(std::ios_base::eofbit);
+ ios_02.exceptions(std::ios_base::eofbit);
+
+ try {
+ ios_01.copyfmt(ios_02);
+ VERIFY( false );
+ }
+ catch(std::ios_base::failure& fail) {
+ VERIFY( true );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+ }
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc
new file mode 100644
index 000000000..2f3fa49da
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc
@@ -0,0 +1,66 @@
+// { dg-require-namedlocale "de_DE" }
+
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999, 2003, 2005, 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/>.
+
+
+// 27.4.4.2 basic_ios member functions
+
+// NB: Don't include any other headers in this file.
+#include <ios>
+#include <testsuite_hooks.h>
+
+// copyfmt and locales.
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ using namespace std;
+
+ typedef std::ios_base::fmtflags fmtflags;
+ typedef std::ios_base::iostate iostate;
+ locale loc_c = locale::classic();
+ locale loc_de = locale("de_DE");
+ std::ios ios_01(0);
+ std::ios ios_02(0);
+ ios_01.imbue(loc_c);
+ ios_02.imbue(loc_de);
+ ios_02.setstate(ios_base::badbit);
+ VERIFY( loc_c == ios_01.getloc() );
+ VERIFY( loc_de == ios_02.getloc() );
+
+ iostate ios1 = ios_01.rdstate();
+ iostate ios2 = ios_02.rdstate();
+ streambuf* sb1 = ios_01.rdbuf();
+ streambuf* sb2 = ios_02.rdbuf();
+ ios_01.copyfmt(ios_02);
+
+ VERIFY( loc_de == ios_01.getloc() );
+ VERIFY( ios_01.getloc() == ios_02.getloc() );
+ VERIFY( ios1 == ios_01.rdstate() );
+ VERIFY( ios2 == ios_02.rdstate() );
+ VERIFY( sb1 == ios_01.rdbuf() );
+ VERIFY( sb2 == ios_02.rdbuf() );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
new file mode 100644
index 000000000..f0494bd45
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
@@ -0,0 +1,76 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999, 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/>.
+
+
+// 27.4.4.2 basic_ios member functions
+
+// NB: Don't include any other headers in this file.
+#include <ios>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::ios_base::fmtflags fmtflags;
+ typedef std::ios_base::iostate iostate;
+ using std::ios_base;
+
+ // iostate exceptions() const
+ iostate iostate02;
+ {
+ std::ios ios_01(0);
+ VERIFY( ios_01.exceptions() == std::ios_base::goodbit );
+ }
+
+ // void exceptions(iostate except)
+ {
+ std::ios ios_01(0);
+ try {
+ ios_01.exceptions(std::ios_base::eofbit);
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+ iostate02 = ios_01.exceptions();
+ VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
+ }
+
+ {
+ std::ios ios_01(0);
+ ios_01.clear(std::ios_base::eofbit);
+ try {
+ ios_01.exceptions(std::ios_base::eofbit);
+ VERIFY( false );
+ }
+ catch(std::ios_base::failure& fail) {
+ iostate02 = ios_01.exceptions();
+ VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/2.cc
new file mode 100644
index 000000000..11b7d76df
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/2.cc
@@ -0,0 +1,50 @@
+// Copyright (C) 2003, 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/>.
+
+
+// 27.4.4.2 basic_ios member functions
+
+#include <sstream>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ using namespace std;
+ ostringstream stream;
+
+ try
+ {
+ stream.setstate(ios_base::failbit);
+ stream.exceptions(ios_base::failbit);
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ // Don't clear.
+ }
+
+ try
+ {
+ // Calls clear(rdstate()), which throws in this case.
+ stream.setstate(ios_base::goodbit);
+ VERIFY( false );
+ }
+ catch (...)
+ { }
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/imbue/14072.cc b/libstdc++-v3/testsuite/27_io/basic_ios/imbue/14072.cc
new file mode 100644
index 000000000..823d620f0
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/imbue/14072.cc
@@ -0,0 +1,83 @@
+// 2004-02-09 Petur Runolfsson <peturr02@ru.is>
+
+// Copyright (C) 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.4.4.2 basic_ios member functions
+
+#include <sstream>
+#include <locale>
+#include <typeinfo>
+#include <testsuite_hooks.h>
+#include <testsuite_character.h>
+
+// libstdc++/14072
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ locale loc;
+ loc = locale(loc, new ctype<__gnu_test::pod_uchar>());
+ loc = locale(loc, new num_get<__gnu_test::pod_uchar>());
+ loc = locale(loc, new num_put<__gnu_test::pod_uchar>());
+
+ locale::global(loc);
+ basic_stringstream<__gnu_test::pod_uchar> s;
+ s << "10\n";
+ s.seekg(0, ios_base::beg);
+ s.imbue(locale::classic());
+ locale::global(locale::classic());
+ loc = locale::classic();
+
+ try
+ {
+ s.widen('\0');
+ }
+ catch (bad_cast&)
+ {
+ }
+
+ s.clear();
+
+ try
+ {
+ int i = 0;
+ s << i;
+ }
+ catch (bad_cast&)
+ {
+ }
+
+ s.clear();
+
+ try
+ {
+ int i = 0;
+ s >> i;
+ }
+ catch (bad_cast&)
+ {
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc
new file mode 100644
index 000000000..20de8a957
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/locales/char/1.cc
@@ -0,0 +1,52 @@
+// 1999-09-20 bkoz
+
+// Copyright (C) 1999, 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/>.
+
+
+// 27.4.4.2 basic_ios member functions
+
+// NB: Don't include any other headers in this file.
+#include <ios>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ const std::locale c_loc = std::locale::classic();
+
+ std::ios ios_01(0);
+ std::ios::char_type ct01;
+ std::ios::char_type ct02('x');;
+
+ // 27.4.2.3 locales
+ ios_01.imbue(c_loc);
+
+ // char narrow(char_type c, char dfault) const;
+ char c1 = ios_01.narrow(ct02, 0);
+ VERIFY( c1 == 'x' );
+
+ // char_type widen(char c) const;
+ ct01 = ios_01.widen('c');
+ VERIFY( ct01 == 'c' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/requirements/base_classes.cc b/libstdc++-v3/testsuite/27_io/basic_ios/requirements/base_classes.cc
new file mode 100644
index 000000000..7f2859753
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/requirements/base_classes.cc
@@ -0,0 +1,46 @@
+// { dg-do compile }
+// 2003-03-26 Benjamin Kosnik <bkoz@redhat.com>
+
+// 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/>.
+
+// 27.8.1.1 - Template class basic_filebuf
+
+#include <ios>
+#include <sstream>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::ios test_type;
+ typedef std::ios_base base_type;
+
+ std::stringbuf buf;
+ const test_type& obj = *new test_type(&buf);
+ const base_type* base __attribute__((unused)) = &obj;
+}
+
+// more surf!!!
+
+
+
+
+
+
+
+
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/27_io/basic_ios/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..831370805
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/requirements/explicit_instantiation.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2002, 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/>.
+
+
+// 27.4.4 - Template class basic_ios
+// NB: This file is for testing basic_ios with NO OTHER INCLUDES.
+
+#include <ios>
+
+namespace std
+{
+ typedef short type_t;
+ template class basic_ios<type_t, char_traits<type_t> >;
+} // test
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/requirements/typedefs.cc b/libstdc++-v3/testsuite/27_io/basic_ios/requirements/typedefs.cc
new file mode 100644
index 000000000..093de91b2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/requirements/typedefs.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2002, 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.4.4 - Template class basic_ios
+// NB: This file is for testing basic_ios with NO OTHER INCLUDES.
+
+#include <ios>
+
+// libstdc++/7216
+void test01()
+{
+ // Check for required typedefs
+ typedef std::ios test_type;
+ typedef test_type::char_type char_type;
+ typedef test_type::traits_type traits_type;
+ typedef test_type::int_type int_type;
+ typedef test_type::pos_type pos_type;
+ typedef test_type::off_type off_type;
+}