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 11 // constexpr explicit iterator(W value); 12 13 #include <cassert> 14 #include <ranges> 15 #include <type_traits> 16 17 #include "test_macros.h" 18 #include "../types.h" 19 test()20constexpr bool test() { 21 { 22 using Iter = std::ranges::iterator_t<std::ranges::iota_view<int>>; 23 auto iter = Iter(42); 24 assert(*iter == 42); 25 } 26 { 27 using Iter = std::ranges::iterator_t<std::ranges::iota_view<SomeInt>>; 28 auto iter = Iter(SomeInt(42)); 29 assert(*iter == SomeInt(42)); 30 } 31 { 32 using Iter = std::ranges::iterator_t<std::ranges::iota_view<SomeInt>>; 33 static_assert(!std::is_convertible_v<Iter, SomeInt>); 34 static_assert( std::is_constructible_v<Iter, SomeInt>); 35 } 36 37 return true; 38 } 39 main(int,char **)40int main(int, char**) { 41 test(); 42 static_assert(test()); 43 44 return 0; 45 } 46