summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/ios_base
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/ios_base
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/ios_base')
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/callbacks/1.cc61
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc38
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc28
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc59
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc72
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc40
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/state/1.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc53
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc63
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc143
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc51
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc64
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc32
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/2.cc56
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/9523.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc29
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc28
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc29
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc46
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc28
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc29
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc50
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc28
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/types/seekdir/case_label.cc44
27 files changed, 1336 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/callbacks/1.cc b/libstdc++-v3/testsuite/27_io/ios_base/callbacks/1.cc
new file mode 100644
index 000000000..01b2af053
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/callbacks/1.cc
@@ -0,0 +1,61 @@
+// 1999-11-10 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.2.6 ios_base callbacks
+
+#include <string>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+const std::string str01("the nubians of plutonia");
+std::string str02;
+
+void
+callb01(std::ios_base::event, std::ios_base&, int)
+{ str02 += "the nubians"; }
+
+void
+callb02(std::ios_base::event, std::ios_base&, int)
+{ str02 += " of "; }
+
+void
+callb03(std::ios_base::event, std::ios_base&, int)
+{ str02 += "plutonia"; }
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::locale loc("C");
+ std::stringbuf strbuf01;
+ std::ios ios01(&strbuf01);
+
+ ios01.register_callback(callb03, 1);
+ ios01.register_callback(callb02, 1);
+ ios01.register_callback(callb01, 1);
+ ios01.imbue(loc);
+ VERIFY( str01 == str02 );
+}
+
+
+int main(void)
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
new file mode 100644
index 000000000..4bbe5b119
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// 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 <ios>
+
+// Library defect report
+//50. Copy constructor and assignment operator of ios_base
+class test_base : public std::ios_base { };
+
+void test01()
+{
+ // assign
+ test_base io1;
+ test_base io2;
+ io1 = io2;
+}
+// { dg-error "synthesized" "" { target *-*-* } 33 }
+// { dg-error "within this context" "" { target *-*-* } 26 }
+// { dg-error "is private" "" { target *-*-* } 791 }
+// { dg-error "operator=" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
new file mode 100644
index 000000000..6f453736e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
@@ -0,0 +1,38 @@
+// { dg-do compile }
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+// 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 <ios>
+
+// Library defect report
+//50. Copy constructor and assignment operator of ios_base
+struct test_base : public std::ios_base
+{ };
+
+void test02()
+{
+ // copy ctor
+ test_base io1;
+ test_base io2 = io1;
+}
+// { dg-error "within this context" "" { target *-*-* } 26 }
+// { dg-error "synthesized" "" { target *-*-* } 33 }
+// { dg-error "is private" "" { target *-*-* } 788 }
+// { dg-error "copy constructor" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc
new file mode 100644
index 000000000..fbf52b0fa
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc
@@ -0,0 +1,28 @@
+// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 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 <ios>
+#include <testsuite_api.h>
+
+int main()
+{
+ typedef std::ios_base::failure test_type;
+ __gnu_test::diamond_derivation<test_type, false>::test();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc
new file mode 100644
index 000000000..7b5e1945c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc
@@ -0,0 +1,59 @@
+// 2001-02-26 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/>.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <ios>
+#include <stdexcept>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/1972
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::string s("lack of sunlight, no water error");
+
+ // 1
+ std::ios_base::failure obj1 = std::ios_base::failure(s);
+
+ // 2
+ std::ios_base::failure obj2(s);
+
+ VERIFY( std::strcmp(obj1.what(), s.data()) == 0 );
+ VERIFY( std::strcmp(obj2.what(), s.data()) == 0 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ std::string s("lack of sunlight error");
+ std::range_error x(s);
+
+ VERIFY( std::strcmp(x.what(), s.data()) == 0 );
+}
+
+int main(void)
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc
new file mode 100644
index 000000000..50e30a260
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc
@@ -0,0 +1,50 @@
+// 2001-02-26 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/>.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <ios>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/2089
+class fuzzy_logic : public std::ios_base::failure
+{
+public:
+ fuzzy_logic() : std::ios_base::failure("whoa") { }
+};
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ try
+ { throw fuzzy_logic(); }
+ catch(const fuzzy_logic& obj)
+ { VERIFY( std::strcmp("whoa", obj.what()) == 0 ); }
+ catch(...)
+ { VERIFY( false ); }
+}
+
+int main(void)
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
new file mode 100644
index 000000000..ddb29c5ef
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
@@ -0,0 +1,72 @@
+// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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/>.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <ios>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// test copy ctors, assignment operators, and persistence of member string data
+// libstdc++/1972
+// via Greg Bumgardner <bumgard@roguewave.com>
+void allocate_on_stack(void)
+{
+ const size_t num = 512;
+ __extension__ char array[num];
+ for (size_t i = 0; i < num; i++)
+ array[i]=0;
+ for (size_t i = 0; i < num; i++)
+ array[i]=array[i]; // Suppress unused warning.
+}
+
+void test04()
+{
+ bool test __attribute__((unused)) = true;
+ const std::string s("CA ISO emergency once again:immediate power down");
+ const char* strlit1 = "wish I lived in Palo Alto";
+ const char* strlit2 = "...or Santa Barbara";
+ std::ios_base::failure obj1(s);
+
+ // block 01
+ {
+ const std::string s2(strlit1);
+ std::ios_base::failure obj2(s2);
+ obj1 = obj2;
+ }
+ allocate_on_stack();
+ VERIFY( std::strcmp(strlit1, obj1.what()) == 0 );
+
+ // block 02
+ {
+ const std::string s3(strlit2);
+ std::ios_base::failure obj3 = std::ios_base::failure(s3);
+ obj1 = obj3;
+ }
+ allocate_on_stack();
+ VERIFY( std::strcmp(strlit2, obj1.what()) == 0 );
+}
+
+int main(void)
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc
new file mode 100644
index 000000000..18f5a6a94
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc
@@ -0,0 +1,40 @@
+// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 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 <cstring>
+#include <string>
+#include <ios>
+#include <testsuite_hooks.h>
+
+// Can construct and return 10k character error string.
+void test01()
+{
+ typedef std::ios_base::failure test_type;
+
+ bool test __attribute__((unused)) = true;
+ const std::string xxx(10000, 'x');
+ test_type t(xxx);
+ VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/state/1.cc b/libstdc++-v3/testsuite/27_io/ios_base/state/1.cc
new file mode 100644
index 000000000..70eb9d6e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/state/1.cc
@@ -0,0 +1,53 @@
+// Copyright (C) 1997, 1998, 1999, 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 <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+ const std::string strue("true");
+ const std::string sfalse("false");
+ std::string str01;
+ std::string str02;
+
+ std::locale loc_c = std::locale::classic();
+ std::ostringstream ostr01;
+ ostr01.imbue(loc_c);
+ ostr01.flags(std::ios_base::boolalpha);
+
+ ostr01 << true;
+ str02 = ostr01.str();
+ VERIFY( str02 == strue );
+
+ ostr01.str(str01);
+ ostr01 << false;
+ str02 = ostr01.str();
+ VERIFY( str02 == sfalse );
+}
+
+int
+main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc
new file mode 100644
index 000000000..6203a727c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/1.cc
@@ -0,0 +1,53 @@
+// 2000-12-19 bkoz
+
+// Copyright (C) 2000, 2002, 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.4.2.5 ios_base storage functions
+
+// XXX This test will not work for some versions of irix6 because of
+// XXX bug(s) in libc malloc for very large allocations. However
+// XXX -lmalloc seems to work.
+// See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
+
+#include <sstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00413.html
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using namespace std;
+
+ ios::xalloc();
+ ios::xalloc();
+ ios::xalloc();
+ long x4 = ios::xalloc();
+
+ ostringstream out("the element of crime, lars von trier");
+ out.pword(++x4); // should not crash
+}
+
+int main(void)
+{
+ __gnu_test::set_memory_limits();
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
new file mode 100644
index 000000000..95d3496ac
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
@@ -0,0 +1,63 @@
+// 2004-01-25 jlquinn@gcc.gnu.org
+
+// Copyright (C) 2004, 2005, 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.4.2.5 ios_base storage functions
+
+#include <cstdlib>
+#include <new>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+int new_fails;
+
+void* operator new(std::size_t n) throw (std::bad_alloc)
+{
+ if (new_fails)
+ throw std::bad_alloc();
+ return malloc(n);
+}
+void* operator new[] (std::size_t n) throw (std::bad_alloc)
+{ return operator new(n); }
+
+void operator delete (void *p) throw() { free(p); }
+void operator delete[] (void *p) throw() { operator delete(p); }
+
+int main ()
+{
+ bool test __attribute__((unused)) = true;
+ const int i = std::ios::xalloc();
+ VERIFY( i >= 0 );
+
+ new_fails = 1;
+
+ // Successive accesses to failure storage clears to zero.
+ std::cout.iword(100) = 69;
+ VERIFY( std::cout.iword(100) == 0 );
+
+ // Access to pword failure storage shouldn't clear iword pword storage.
+ long& lr = std::cout.iword(100);
+ lr = 69;
+
+ void* pv = std::cout.pword(100);
+ VERIFY( pv == 0 );
+ VERIFY( lr == 69 );
+
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
new file mode 100644
index 000000000..5c695973a
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
@@ -0,0 +1,143 @@
+// 2000-12-19 bkoz
+
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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.4.2.5 ios_base storage functions
+
+// XXX This test will not work for some versions of irix6 because of
+// XXX bug(s) in libc malloc for very large allocations. However
+// XXX -lmalloc seems to work.
+// See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
+
+// This fails on some versions of Darwin 8 because malloc doesn't return
+// NULL even if an allocation fails (filed as Radar 3884894).
+// { dg-do run { xfail *-*-darwin8.[0-4].* } }
+
+// Skip test at -m64 on Darwin because RLIMITS are not being honored.
+// Radar 6467883: 10.4/10.5 setrlimits are not honored by memory allocators
+// Radar 6467884: 10.X systems are not robust when paging space is exceeded
+// { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } }
+
+#include <sstream>
+#include <iostream>
+#include <limits>
+#include <testsuite_hooks.h>
+
+// libstdc++/3129
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ int max = std::numeric_limits<int>::max() - 1;
+ std::stringbuf strbuf;
+ std::ios ios(&strbuf);
+
+ ios.exceptions(std::ios::badbit);
+
+ long l = 0;
+ void* v = 0;
+
+ // pword
+ ios.pword(1) = v;
+ VERIFY( ios.pword(1) == v );
+
+ try
+ {
+ v = ios.pword(max);
+ }
+ catch(std::ios_base::failure& obj)
+ {
+ // Ok.
+ VERIFY( ios.bad() );
+ }
+ catch(...)
+ {
+ test = false;
+ VERIFY( test );
+ }
+ VERIFY( v == 0 );
+
+ VERIFY( ios.pword(1) == v );
+
+ // max is different code path from max-1
+ v = &test;
+ try
+ {
+ v = ios.pword(std::numeric_limits<int>::max());
+ }
+ catch(std::ios_base::failure& obj)
+ {
+ // Ok.
+ VERIFY( ios.bad() );
+ }
+ catch(...)
+ {
+ test = false;
+ VERIFY( test );
+ }
+ VERIFY( v == &test );
+
+ // iword
+ ios.iword(1) = 1;
+ VERIFY( ios.iword(1) == 1 );
+
+ try
+ {
+ l = ios.iword(max);
+ }
+ catch(std::ios_base::failure& obj)
+ {
+ // Ok.
+ VERIFY( ios.bad() );
+ }
+ catch(...)
+ {
+ test = false;
+ VERIFY( test );
+ }
+ VERIFY( l == 0 );
+
+ VERIFY( ios.iword(1) == 1 );
+
+ // max is different code path from max-1
+ l = 1;
+ try
+ {
+ l = ios.iword(std::numeric_limits<int>::max());
+ }
+ catch(std::ios_base::failure& obj)
+ {
+ // Ok.
+ VERIFY( ios.bad() );
+ }
+ catch(...)
+ {
+ test = false;
+ VERIFY( test );
+ }
+ VERIFY( l == 1 );
+
+}
+
+int main(void)
+{
+ __gnu_test::set_memory_limits();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc
new file mode 100644
index 000000000..aedf2bcc7
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/3.cc
@@ -0,0 +1,51 @@
+// 2000-12-19 bkoz
+
+// Copyright (C) 2000, 2002, 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.4.2.5 ios_base storage functions
+
+// XXX This test will not work for some versions of irix6 because of
+// XXX bug(s) in libc malloc for very large allocations. However
+// XXX -lmalloc seems to work.
+// See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
+// { dg-options "-lmalloc" { target mips*-*-irix6* } }
+
+#include <sstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+class derived : public std::ios_base
+{
+public:
+ derived() {}
+};
+
+void test03()
+{
+ derived d;
+
+ d.pword(0) = &d;
+ d.iword(0) = 1;
+}
+
+int main(void)
+{
+ __gnu_test::set_memory_limits();
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc
new file mode 100644
index 000000000..29ec97548
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/1.cc
@@ -0,0 +1,64 @@
+// 1999-05-21 bkoz
+// 2000-05-21 Benjamin Kosnik <bkoz@redhat.com>
+// 2001-01-17 Loren J. Rittle <ljrittle@acm.org>
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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.4.2.4 ios_base static members
+// @require@ %-*.tst
+// @diff@ %-*.tst %-*.txt
+
+// This test fails on platforms using a wrapper, because this test
+// redirects stdout to a file and so the exit status printed by the
+// wrapper is not visibile to DejaGNU. DejaGNU then assumes that the
+// test exited with a non-zero exit status.
+// { dg-do run { xfail { ! unwrapped } } }
+
+#include <cstdio>
+#include <sstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// N.B. Once we have called sync_with_stdio(false), we can never go back.
+
+void
+test01()
+{
+ std::ios_base::sync_with_stdio();
+ VERIFY( std::freopen("ios_base_members_static-1.txt", "w", stderr) );
+
+ for (int i = 0; i < 2; i++)
+ {
+ std::fprintf(stderr, "1");
+ std::cerr << "2";
+ std::putc('3', stderr);
+ std::cerr << '4';
+ std::fputs("5", stderr);
+ std::cerr << 6;
+ std::putc('7', stderr);
+ std::cerr << 8 << '9';
+ std::fprintf(stderr, "0\n");
+ }
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc
new file mode 100644
index 000000000..e2fc2991e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc
@@ -0,0 +1,32 @@
+// Copyright (C) 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.4.2.4 ios_base static members
+
+#include <ios>
+
+// libstdc++/16959
+void test01()
+{
+ std::ios_base::sync_with_stdio(false);
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/2.cc b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/2.cc
new file mode 100644
index 000000000..8c10c3fe9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/2.cc
@@ -0,0 +1,56 @@
+// 1999-05-21 bkoz
+// 2000-05-21 Benjamin Kosnik <bkoz@redhat.com>
+// 2001-01-17 Loren J. Rittle <ljrittle@acm.org>
+
+// Copyright (C) 1999, 2000, 2001, 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.4.2.4 ios_base static members
+// @require@ %-*.tst
+// @diff@ %-*.tst %-*.txt
+
+#include <cstdio>
+#include <sstream>
+#include <iostream>
+#include <testsuite_hooks.h>
+
+// N.B. Once we have called sync_with_stdio(false), we can never go back.
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::stringbuf strbuf01;
+ std::ios ios01(&strbuf01);
+
+ // 1: basic invocation
+ VERIFY( ios01.sync_with_stdio() );
+ VERIFY( ios01.sync_with_stdio(false) ); //returns previous state
+
+ // 2: need to test interleaving of C and C++ io on a file object.
+ VERIFY( std::cout.good() );
+ VERIFY( !std::cout.sync_with_stdio(0) );
+ VERIFY( std::cout.good() );
+ VERIFY( !std::cout.sync_with_stdio(0) );
+ VERIFY( std::cout.good() );
+}
+
+int main(void)
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/9523.cc b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/9523.cc
new file mode 100644
index 000000000..517d96d9c
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/9523.cc
@@ -0,0 +1,50 @@
+// 2003-04-26 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.4.2.4 ios_base static members
+
+#include <testsuite_hooks.h>
+#include <iostream>
+
+// libstdc++/9523
+void test01()
+{
+ using namespace std;
+
+ int index = ios_base::xalloc();
+
+ cin.iword(index) = 5;
+ cout.iword(index) = 6;
+ cerr.iword(index) = 7;
+ clog.iword(index) = 8;
+
+ ios_base::sync_with_stdio(false);
+
+ VERIFY( cin.iword(index) == 5 );
+ VERIFY( cout.iword(index) == 6 );
+ VERIFY( cerr.iword(index) == 7 );
+ VERIFY( clog.iword(index) == 8 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc
new file mode 100644
index 000000000..671a1f1ff
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2008, 2009 Free Software Foundation, Inc.
+
+// 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/>.
+
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::bitmask_operators<std::ios_base::fmtflags>();
+};
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
new file mode 100644
index 000000000..eb470318b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
@@ -0,0 +1,74 @@
+// { dg-do compile }
+// { dg-options "-Wall" { target *-*-* } }
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+
+// 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/>.
+
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+
+// PR libstdc++/17922
+// -Wall
+typedef std::ios_base::fmtflags bitmask_type;
+
+void
+case_labels(bitmask_type b)
+{
+ switch (b)
+ {
+ case std::ios_base::boolalpha:
+ break;
+ case std::ios_base::dec:
+ break;
+ case std::ios_base::fixed:
+ break;
+ case std::ios_base::hex:
+ break;
+ case std::ios_base::internal:
+ break;
+ case std::ios_base::left:
+ break;
+ case std::ios_base::oct:
+ break;
+ case std::ios_base::right:
+ break;
+ case std::ios_base::scientific:
+ break;
+ case std::ios_base::showbase:
+ break;
+ case std::ios_base::showpoint:
+ break;
+ case std::ios_base::showpos:
+ break;
+ case std::ios_base::skipws:
+ break;
+ case std::ios_base::unitbuf:
+ break;
+ case std::ios_base::uppercase:
+ break;
+ case std::ios_base::adjustfield:
+ break;
+ case std::ios_base::basefield:
+ break;
+ case std::ios_base::floatfield:
+ break;
+ case std::_S_ios_fmtflags_end:
+ break;
+ }
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc
new file mode 100644
index 000000000..349f7f9f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/constexpr_operators.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 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 <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_bitwise_operators<std::ios_base::fmtflags>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc
new file mode 100644
index 000000000..00ad1be19
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2008, 2009 Free Software Foundation, Inc.
+
+// 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/>.
+
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::bitmask_operators<std::ios_base::iostate>();
+};
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
new file mode 100644
index 000000000..8fe23b665
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
@@ -0,0 +1,46 @@
+// { dg-do compile }
+// { dg-options "-Wall" { target *-*-* } }
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+
+// 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/>.
+
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+
+// PR libstdc++/17922
+// -Wall
+typedef std::ios_base::iostate bitmask_type;
+
+void
+case_labels(bitmask_type b)
+{
+ switch (b)
+ {
+ case std::ios_base::goodbit:
+ break;
+ case std::ios_base::badbit:
+ break;
+ case std::ios_base::eofbit:
+ break;
+ case std::ios_base::failbit:
+ break;
+ case std::_S_ios_iostate_end:
+ break;
+ }
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc
new file mode 100644
index 000000000..fd3ce1055
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/iostate/constexpr_operators.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 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 <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_bitwise_operators<std::ios_base::iostate>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc
new file mode 100644
index 000000000..76114c275
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2008, 2009 Free Software Foundation, Inc.
+
+// 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/>.
+
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::bitmask_operators<std::ios_base::openmode>();
+};
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc
new file mode 100644
index 000000000..f2e3e54dc
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc
@@ -0,0 +1,50 @@
+// { dg-do compile }
+// { dg-options "-Wall" { target *-*-* } }
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+
+// 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/>.
+
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+
+// PR libstdc++/17922
+// -Wall
+typedef std::ios_base::openmode bitmask_type;
+
+void
+case_labels(bitmask_type b)
+{
+ switch (b)
+ {
+ case std::ios_base::app:
+ break;
+ case std::ios_base::ate:
+ break;
+ case std::ios_base::binary:
+ break;
+ case std::ios_base::in:
+ break;
+ case std::ios_base::out:
+ break;
+ case std::ios_base::trunc:
+ break;
+ case std::_S_ios_openmode_end:
+ break;
+ }
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc
new file mode 100644
index 000000000..66041b87e
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/openmode/constexpr_operators.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 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 <ios>
+#include <testsuite_common_types.h>
+
+int main()
+{
+ __gnu_test::constexpr_bitwise_operators<std::ios_base::openmode>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/types/seekdir/case_label.cc b/libstdc++-v3/testsuite/27_io/ios_base/types/seekdir/case_label.cc
new file mode 100644
index 000000000..2047a78b6
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/types/seekdir/case_label.cc
@@ -0,0 +1,44 @@
+// { dg-do compile }
+// { dg-options "-Wall" { target *-*-* } }
+// -*- C++ -*-
+
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+
+// 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/>.
+
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+
+// PR libstdc++/17922
+// -Wall
+typedef std::ios_base::seekdir test_type;
+
+void
+case_labels(test_type b)
+{
+ switch (b)
+ {
+ case std::ios_base::beg:
+ break;
+ case std::ios_base::cur:
+ break;
+ case std::ios_base::end:
+ break;
+ case std::_S_ios_fmtflags_end:
+ break;
+ }
+}