brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · ba6e2eb Raw
38 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 11// drop_view() requires default_initializable<V> = default;12 13#include <ranges>14 15#include "test_macros.h"16#include "types.h"17 18constexpr bool test() {19  std::ranges::drop_view<MoveOnlyView> dropView1;20  assert(std::ranges::begin(dropView1) == globalBuff);21 22  static_assert( std::is_default_constructible_v<std::ranges::drop_view<ForwardView>>);23  static_assert(!std::is_default_constructible_v<std::ranges::drop_view<NoDefaultCtorForwardView>>);24 25  LIBCPP_STATIC_ASSERT( std::is_nothrow_default_constructible_v<std::ranges::drop_view<ForwardView>>);26  static_assert(!std::is_nothrow_default_constructible_v<ThrowingDefaultCtorForwardView>);27  static_assert(!std::is_nothrow_default_constructible_v<std::ranges::drop_view<ThrowingDefaultCtorForwardView>>);28 29  return true;30}31 32int main(int, char**) {33  test();34  static_assert(test());35 36  return 0;37}38