brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · beebc36 Raw
68 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// UNSUPPORTED: c++03, c++11, c++14, c++1710// UNSUPPORTED: no-localization11// UNSUPPORTED: libcpp-has-no-experimental-syncstream12 13// <syncstream>14 15// template <class charT, class traits, class Allocator>16// class basic_syncbuf;17 18// basic_syncbuf();19 20#include <cassert>21#include <concepts>22#include <syncstream>23 24#include "test_macros.h"25#include "constexpr_char_traits.h"26#include "test_allocator.h"27 28template <class CharT>29std::basic_syncbuf<CharT> lwg3253_default_constructor_is_not_explicit() {30  return {};31}32 33template <class CharT>34void test() {35  lwg3253_default_constructor_is_not_explicit<CharT>();36 37  {38    using Buf = std::basic_syncbuf<CharT>;39    static_assert(std::default_initializable<Buf>);40    Buf buf;41    assert(buf.get_wrapped() == nullptr);42    assert(buf.get_allocator() == std::allocator<CharT>());43  }44  {45    using Buf = std::basic_syncbuf<CharT, constexpr_char_traits<CharT>>;46    static_assert(std::default_initializable<Buf>);47    Buf buf;48    assert(buf.get_wrapped() == nullptr);49    assert(buf.get_allocator() == std::allocator<CharT>());50  }51  {52    using Buf = std::basic_syncbuf<CharT, constexpr_char_traits<CharT>, test_allocator<CharT>>;53    static_assert(std::default_initializable<Buf>);54    Buf buf;55    assert(buf.get_wrapped() == nullptr);56    assert(buf.get_allocator() == test_allocator<CharT>());57  }58}59 60int main(int, char**) {61  test<char>();62#ifndef TEST_HAS_NO_WIDE_CHARACTERS63  test<wchar_t>();64#endif65 66  return 0;67}68