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