blob: 28e3c95d4b2d5859f9fe4e89b494a00ca2dcf89f [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <fstream>
11
12// template <class charT, class traits = char_traits<charT> >
13// class basic_fstream
14
15// basic_fstream(basic_fstream&& rhs);
16
17#include <fstream>
18#include <cassert>
19
20int main()
21{
Howard Hinnant7609c9b2010-09-04 23:28:19 +000022#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Alexis Hunt483cf242011-07-18 23:51:21 +000023 char temp[L_tmpnam];
24 tmpnam(temp);
Howard Hinnant3e519522010-05-11 19:42:16 +000025 {
Alexis Hunt483cf242011-07-18 23:51:21 +000026 std::fstream fso(temp, std::ios_base::in | std::ios_base::out
27 | std::ios_base::trunc);
Howard Hinnant3e519522010-05-11 19:42:16 +000028 std::fstream fs = move(fso);
29 double x = 0;
30 fs << 3.25;
31 fs.seekg(0);
32 fs >> x;
33 assert(x == 3.25);
34 }
35 std::remove("test.dat");
36 {
Alexis Hunt483cf242011-07-18 23:51:21 +000037 std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
38 | std::ios_base::trunc);
Howard Hinnant3e519522010-05-11 19:42:16 +000039 std::wfstream fs = move(fso);
40 double x = 0;
41 fs << 3.25;
42 fs.seekg(0);
43 fs >> x;
44 assert(x == 3.25);
45 }
Alexis Hunt483cf242011-07-18 23:51:21 +000046 std::remove(temp);
Howard Hinnant7609c9b2010-09-04 23:28:19 +000047#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnant3e519522010-05-11 19:42:16 +000048}