]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_ifstream/cons/move.cc
1 // Copyright (C) 2014 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-options "-std=gnu++11" }
19 // { dg-require-fileio "" }
21 // 27.9.1.7 basic_ifstream constructors [ifstream.cons]
25 #include <testsuite_hooks.h>
28 read(std::istream
& in
, std::ostream
& out
)
31 for (int i
=0; i
< 10; ++i
)
41 std::string
const name
= "thirty_years_among_the_dead_preproc.txt";
42 std::ostringstream ss0
;
44 std::ifstream
f0(name
);
47 std::ifstream
f0(name
);
48 std::ifstream f1
= std::move(f0
);
49 VERIFY( !f0
.is_open() );
50 VERIFY( f1
.is_open() );
51 std::ostringstream ss1
;
53 VERIFY( ss0
.str() == ss1
.str() );
59 #ifdef _GLIBCXX_USE_WCHAR_T
60 std::wifstream
f0("thirty_years_among_the_dead_preproc.txt");
61 std::wifstream f1
= std::move(f0
);
62 VERIFY( f1
.is_open() );