1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
12 // class basic_stringstream
14 // explicit basic_stringstream(ios_base::openmode which = ios_base::out | ios_base::in); // before C++20
15 // basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {} // C++20
16 // explicit basic_stringstream(ios_base::openmode which); // C++20
18 // XFAIL: FROZEN-CXX03-HEADERS-FIXME
23 #include "test_macros.h"
24 #include "operator_hijacker.h"
25 #if TEST_STD_VER >= 11
26 #include "test_convertible.h"
30 static_assert(test_convertible
<S
>(), "");
31 static_assert(!test_convertible
<S
, std::ios_base::openmode
>(), "");
39 assert(ss
.rdbuf() != nullptr);
41 assert(ss
.str() == "");
44 std::basic_stringstream
<char, std::char_traits
<char>, operator_hijacker_allocator
<char> > ss
;
45 assert(ss
.rdbuf() != nullptr);
47 assert(ss
.str() == "");
50 std::stringstream
ss(std::ios_base::in
);
51 assert(ss
.rdbuf() != nullptr);
53 assert(ss
.str() == "");
56 std::basic_stringstream
<char, std::char_traits
<char>, operator_hijacker_allocator
<char> > ss(std::ios_base::in
);
57 assert(ss
.rdbuf() != nullptr);
59 assert(ss
.str() == "");
61 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
63 std::wstringstream ss
;
64 assert(ss
.rdbuf() != nullptr);
66 assert(ss
.str() == L
"");
69 std::wstringstream
ss(std::ios_base::in
);
70 assert(ss
.rdbuf() != nullptr);
72 assert(ss
.str() == L
"");
76 #if TEST_STD_VER >= 11
77 test
<std::stringstream
>();
78 # ifndef TEST_HAS_NO_WIDE_CHARACTERS
79 test
<std::wstringstream
>();