50 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM10 11// <strstream>12 13// class strstreambuf14 15// explicit strstreambuf(streamsize alsize_arg = 0); // before C++2016// strstreambuf() : strstreambuf(0) {} // C++2017// explicit strstreambuf(streamsize alsize_arg); // C++2018 19#include <strstream>20#include <cassert>21 22#include "test_macros.h"23#if TEST_STD_VER >= 1124#include "test_convertible.h"25#endif26 27int 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 >= 1141 {42 typedef std::strstreambuf B;43 static_assert(test_convertible<B>(), "");44 static_assert(!test_convertible<B, std::streamsize>(), "");45 }46#endif47 48 return 0;49}50