Differential D91292 Diff 308912 libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
Changeset View
Changeset View
Standalone View
Standalone View
libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// <sstream> | // <sstream> | ||||
// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > | // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > | ||||
// class basic_stringbuf | // class basic_stringbuf | ||||
// explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out); | // explicit basic_stringbuf(ios_base::openmode which = ios_base::in | ios_base::out); // before C++20 | ||||
// basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {} // C++20 | |||||
// explicit basic_stringbuf(ios_base::openmode which); // C++20 | |||||
#include <sstream> | #include <sstream> | ||||
#include <cassert> | #include <cassert> | ||||
#include "test_macros.h" | #include "test_macros.h" | ||||
#if TEST_STD_VER >= 11 | |||||
#include "test_convertible.h" | |||||
#endif | |||||
template<typename CharT> | template<typename CharT> | ||||
struct testbuf | struct testbuf | ||||
: std::basic_stringbuf<CharT> | : std::basic_stringbuf<CharT> | ||||
{ | { | ||||
void check() | void check() | ||||
{ | { | ||||
assert(this->eback() == NULL); | assert(this->eback() == NULL); | ||||
Show All 19 Lines | int main(int, char**) | ||||
testbuf<char> buf; | testbuf<char> buf; | ||||
buf.check(); | buf.check(); | ||||
} | } | ||||
{ | { | ||||
testbuf<wchar_t> buf; | testbuf<wchar_t> buf; | ||||
buf.check(); | buf.check(); | ||||
} | } | ||||
#if TEST_STD_VER >= 11 | |||||
{ | |||||
typedef std::stringbuf B; | |||||
#if TEST_STD_VER > 17 | |||||
static_assert(test_convertible<B>(), ""); | |||||
#else | |||||
static_assert(!test_convertible<B>(), ""); | |||||
#endif | |||||
static_assert(!test_convertible<B, std::ios_base::openmode>(), ""); | |||||
} | |||||
#endif | |||||
return 0; | return 0; | ||||
} | } |