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