[RISCV] Improve Errors for X1/X5/X1X5 Reg Classes (#126184)
[llvm-project.git] / libcxx / test / std / input.output / string.streams / stringbuf / stringbuf.cons / string.move.mode.pass.cpp
blob120a8ea965b575d785d87917efe62aa5f35b1ba3
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // <sstream>
13 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
14 // class basic_stringbuf
16 // explicit basic_stringbuf(basic_string<charT, traits, Allocator>&& s, ios_base::openmode which = ios_base::in | ios_base::out);
18 #include <sstream>
19 #include <cassert>
21 #include "make_string.h"
22 #include "test_allocator.h"
23 #include "test_macros.h"
25 #define STR(S) MAKE_STRING(CharT, S)
26 #define SV(S) MAKE_STRING_VIEW(CharT, S)
28 template <class CharT>
29 static void test() {
31 std::basic_string<CharT> s(STR("testing"));
32 const std::basic_stringbuf<CharT> buf(std::move(s));
33 assert(buf.view() == SV("testing"));
36 std::basic_string<CharT> s(STR("testing"));
37 const std::basic_stringbuf<CharT> buf(std::move(s), std::ios_base::out);
38 assert(buf.view() == SV("testing"));
41 std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT>> s(STR("testing"));
42 const std::basic_stringbuf<CharT, std::char_traits<CharT>, test_allocator<CharT>> buf(std::move(s));
43 assert(buf.view() == SV("testing"));
46 std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT>> s(STR("testing"));
47 const std::basic_stringbuf<CharT, std::char_traits<CharT>, test_allocator<CharT>> buf(
48 std::move(s), std::ios_base::in);
49 assert(buf.view() == SV("testing"));
53 int main(int, char**) {
54 test<char>();
55 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
56 test<wchar_t>();
57 #endif
58 return 0;