]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_ios / copyfmt / char / 1.cc
CommitLineData
23cac885 1// 1999-09-20 bkoz
afb6c265 2
7adcbafe 3// Copyright (C) 1999-2022 Free Software Foundation, Inc.
afb6c265
PC
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
748086b7 8// Free Software Foundation; either version 3, or (at your option)
afb6c265
PC
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
748086b7
JJ
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
afb6c265 19
23cac885 20// 27.4.4.2 basic_ios member functions
afb6c265 21
23cac885
BK
22// NB: Don't include any other headers in this file.
23#include <ios>
afb6c265
PC
24#include <testsuite_hooks.h>
25
23cac885
BK
26// 27.4.4.3 basic_ios iostate flags function
27void test02()
afb6c265 28{
23cac885
BK
29 typedef std::ios_base::fmtflags fmtflags;
30 typedef std::ios_base::iostate iostate;
31 using std::ios_base;
afb6c265 32
23cac885 33 // basic_ios& copyfmt(const basic_ios& rhs)
ff5d863f 34 {
8fc81078 35 std::ios ios_01(0);
cdd17d6e 36 std::ios ios_02(0);
23cac885
BK
37 ios_01.exceptions(std::ios_base::eofbit);
38 ios_02.exceptions(std::ios_base::eofbit);
cdd17d6e 39
23cac885 40 try {
cdd17d6e
JW
41 ios_01.copyfmt(ios_02);
42 }
23cac885
BK
43 catch(...) {
44 VERIFY( false );
45 }
ff5d863f 46 }
ff5d863f 47
23cac885 48 {
8fc81078 49 std::ios ios_01(0);
cdd17d6e 50 std::ios ios_02(0);
23cac885
BK
51 ios_01.clear(std::ios_base::eofbit);
52 ios_02.exceptions(std::ios_base::eofbit);
ff5d863f 53
23cac885
BK
54 try {
55 ios_01.copyfmt(ios_02);
56 VERIFY( false );
cdd17d6e 57 }
5f302518 58 catch(std::ios_base::failure&) {
23cac885
BK
59 VERIFY( true );
60 }
61 catch(...) {
62 VERIFY( false );
63 }
64 }
ff5d863f
PC
65}
66
cdd17d6e 67int main()
afb6c265 68{
ff5d863f 69 test02();
afb6c265
PC
70 return 0;
71}