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 // iota_view() requires default_initializable<W> = default;
14 
15 #include <ranges>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 #include "types.h"
20 
21 constexpr bool test() {
22   {
23     std::ranges::iota_view<Int42<DefaultTo42>> io;
24     assert((*io.begin()).value_ == 42);
25   }
26 
27   return true;
28 }
29 
30 int main(int, char**) {
31   test();
32   static_assert(test());
33 
34   static_assert(!std::default_initializable<Int42<ValueCtor>>);
35   static_assert( std::default_initializable<Int42<DefaultTo42>>);
36 
37   return 0;
38 }
39