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