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 // constexpr iterator begin() const; 13 14 #include <cassert> 15 #include <ranges> 16 #include <utility> 17 18 #include "test_macros.h" 19 #include "types.h" 20 21 template<class T> testType()22constexpr void testType() { 23 { 24 std::ranges::iota_view<T> io(T(0)); 25 assert(*io.begin() == T(0)); 26 } 27 { 28 std::ranges::iota_view<T> io(T(10)); 29 assert(*io.begin() == T(10)); 30 assert(*std::move(io).begin() == T(10)); 31 } 32 { 33 const std::ranges::iota_view<T> io(T(0)); 34 assert(*io.begin() == T(0)); 35 } 36 { 37 const std::ranges::iota_view<T> io(T(10)); 38 assert(*io.begin() == T(10)); 39 } 40 } 41 test()42constexpr bool test() { 43 testType<SomeInt>(); 44 testType<long long>(); 45 testType<unsigned long long>(); 46 testType<signed long>(); 47 testType<unsigned long>(); 48 testType<int>(); 49 testType<unsigned>(); 50 testType<short>(); 51 testType<unsigned short>(); 52 53 return true; 54 } 55 main(int,char **)56int main(int, char**) { 57 test(); 58 static_assert(test()); 59 60 return 0; 61 } 62