1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template <class charT, class traits = char_traits<charT> >
13 // class basic_ostream;
15 // basic_ostream(basic_ostream&& rhs);
20 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
22 template <class CharT>
24 : public std::basic_streambuf<CharT>
29 template <class CharT>
31 : public std::basic_ostream<CharT>
33 typedef std::basic_ostream<CharT> base;
34 test_ostream(testbuf<CharT>* sb) : base(sb) {}
36 test_ostream(test_ostream&& s)
37 : base(std::move(s)) {}
40 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
44 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
47 test_ostream<char> os1(&sb);
48 test_ostream<char> os(std::move(os1));
49 assert(os1.rdbuf() == &sb);
50 assert(os.rdbuf() == 0);
51 assert(os.tie() == 0);
52 assert(os.fill() == ' ');
53 assert(os.rdstate() == os.goodbit);
54 assert(os.exceptions() == os.goodbit);
55 assert(os.flags() == (os.skipws | os.dec));
56 assert(os.precision() == 6);
57 assert(os.getloc().name() == "C");
61 test_ostream<wchar_t> os1(&sb);
62 test_ostream<wchar_t> os(std::move(os1));
63 assert(os1.rdbuf() == &sb);
64 assert(os.rdbuf() == 0);
65 assert(os.tie() == 0);
66 assert(os.fill() == L' ');
67 assert(os.rdstate() == os.goodbit);
68 assert(os.exceptions() == os.goodbit);
69 assert(os.flags() == (os.skipws | os.dec));
70 assert(os.precision() == 6);
71 assert(os.getloc().name() == "C");
73 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES