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 //===----------------------------------------------------------------------===//
8 
9 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM
10 
11 // <strstream>
12 
13 // class strstreambuf
14 
15 // explicit strstreambuf(streamsize alsize_arg = 0); // before C++20
16 // strstreambuf() : strstreambuf(0) {}               // C++20
17 // explicit strstreambuf(streamsize alsize_arg);     // C++20
18 
19 #include <strstream>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 #if TEST_STD_VER >= 11
24 #include "test_convertible.h"
25 #endif
26 
main(int,char **)27 int main(int, char**)
28 {
29     {
30         std::strstreambuf s;
31         assert(s.str() == nullptr);
32         assert(s.pcount() == 0);
33     }
34     {
35         std::strstreambuf s(1024);
36         LIBCPP_ASSERT(s.str() == nullptr);
37         assert(s.pcount() == 0);
38     }
39 
40 #if TEST_STD_VER >= 11
41     {
42       typedef std::strstreambuf B;
43       static_assert(test_convertible<B>(), "");
44       static_assert(!test_convertible<B, std::streamsize>(), "");
45     }
46 #endif
47 
48     return 0;
49 }
50