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