41 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++17, c++2010 11// repeat_view() requires default_initializable<T> = default;12 13#include <ranges>14#include <cassert>15#include <concepts>16 17struct DefaultInt42 {18 int value = 42;19};20 21struct Int {22 Int(int) {}23};24 25static_assert(std::default_initializable<std::ranges::repeat_view<DefaultInt42>>);26static_assert(!std::default_initializable<std::ranges::repeat_view<Int>>);27 28constexpr bool test() {29 std::ranges::repeat_view<DefaultInt42> rv;30 assert((*rv.begin()).value == 42);31 32 return true;33}34 35int main(int, char**) {36 test();37 static_assert(test());38 39 return 0;40}41