//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03 // // template > // class basic_ostream; // basic_ostream& operator=(basic_ostream&& rhs); #include #include #include "test_macros.h" template struct testbuf : public std::basic_streambuf { testbuf() {} }; template struct test_ostream : public std::basic_ostream { typedef std::basic_ostream base; test_ostream(testbuf* sb) : base(sb) {} test_ostream& operator=(test_ostream&& s) {base::operator=(std::move(s)); return *this;} }; int main(int, char**) { { testbuf sb1; testbuf sb2; test_ostream os1(&sb1); test_ostream os2(&sb2); os2 = (std::move(os1)); assert(os1.rdbuf() == &sb1); assert(os1.tie() == 0); assert(os1.fill() == ' '); assert(os1.rdstate() == os1.goodbit); assert(os1.exceptions() == os1.goodbit); assert(os1.flags() == (os1.skipws | os1.dec)); assert(os1.precision() == 6); assert(os1.getloc().name() == "C"); assert(os2.rdbuf() == &sb2); assert(os2.tie() == 0); assert(os2.fill() == ' '); assert(os2.rdstate() == os2.goodbit); assert(os2.exceptions() == os2.goodbit); assert(os2.flags() == (os2.skipws | os2.dec)); assert(os2.precision() == 6); assert(os2.getloc().name() == "C"); } { testbuf sb1; testbuf sb2; test_ostream os1(&sb1); test_ostream os2(&sb2); os2 = (std::move(os1)); assert(os1.rdbuf() == &sb1); assert(os1.tie() == 0); assert(os1.fill() == ' '); assert(os1.rdstate() == os1.goodbit); assert(os1.exceptions() == os1.goodbit); assert(os1.flags() == (os1.skipws | os1.dec)); assert(os1.precision() == 6); assert(os1.getloc().name() == "C"); assert(os2.rdbuf() == &sb2); assert(os2.tie() == 0); assert(os2.fill() == ' '); assert(os2.rdstate() == os2.goodbit); assert(os2.exceptions() == os2.goodbit); assert(os2.flags() == (os2.skipws | os2.dec)); assert(os2.precision() == 6); assert(os2.getloc().name() == "C"); } return 0; }