1 // { dg-options "-D_GLIBCXX_ASSERT" { target *-*-* } }
2 // 2003-05-01 Petur Runolfsson <peturr02@ru.is>
4 // Copyright (C) 2003 Free Software Foundation
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 // 27.3 Standard iostream objects
24 // Check that standard streams can be used from constructors and
25 // destructors of static objects, provided that an instance of
26 // ios_base::Init has been constructed.
28 void init_standard_streams();
29 int use_standard_streams();
37 init_standard_streams();
38 i
= use_standard_streams();
43 use_standard_streams();
44 init_standard_streams();
48 static Strange static_ob
;
50 #include <testsuite_hooks.h>
53 void init_standard_streams()
55 std::ios_base::Init init
;
58 int use_standard_streams()
60 std::wcout
<< L
"Hello, world!" << std::endl
;
61 std::wcerr
<< L
"World, hello!" << std::endl
;
63 int ret
= std::ios_base::xalloc();
64 std::wcin
.iword(ret
) = ret
+ 1;
65 std::wcout
.iword(ret
) = ret
+ 2;
66 std::wcerr
.iword(ret
) = ret
+ 3;
67 std::wclog
.iword(ret
) = ret
+ 4;
73 bool test
__attribute__((unused
)) = true;
76 VERIFY( std::wcin
.iword(i
) == i
+ 1 );
77 VERIFY( std::wcout
.iword(i
) == i
+ 2 );
78 VERIFY( std::wcerr
.iword(i
) == i
+ 3 );
79 VERIFY( std::wclog
.iword(i
) == i
+ 4 );