[RISCV] Improve Errors for X1/X5/X1X5 Reg Classes (#126184)
[llvm-project.git] / libcxx / test / std / input.output / string.streams / stringbuf / stringbuf.cons / string.alloc.pass.cpp
blob13aa7f0ed0e23ab47c61bd1bc70abe385644f851
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 // template <class SAlloc>
17 // basic_stringbuf(const basic_string<charT, traits, SAlloc>& s, const Allocator& a)
18 // : basic_stringbuf(s, ios_base::in | ios_base::out, a) {}
20 #include <sstream>
21 #include <cassert>
23 #include "make_string.h"
24 #include "test_allocator.h"
25 #include "test_macros.h"
27 #define STR(S) MAKE_STRING(CharT, S)
28 #define SV(S) MAKE_STRING_VIEW(CharT, S)
30 template <class CharT>
31 static void test() {
32 const std::basic_string<CharT> s(STR("testing"));
33 const test_allocator<CharT> a(2);
34 const std::basic_stringbuf<CharT, std::char_traits<CharT>, test_allocator<CharT>> buf(s, a);
35 assert(buf.get_allocator() == a);
36 assert(buf.view() == SV("testing"));
39 int main(int, char**) {
40 test<char>();
41 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
42 test<wchar_t>();
43 #endif
44 return 0;