44 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// sentinel() = default;12 13#include <cassert>14#include <ranges>15 16struct Sent {17 bool b; // deliberately uninitialised18 19 friend constexpr bool operator==(int*, const Sent& s) { return s.b; }20};21 22struct Range : std::ranges::view_base {23 int* begin() const;24 Sent end();25};26 27constexpr bool test() {28 {29 using R = std::ranges::take_while_view<Range, bool (*)(int)>;30 using Sentinel = std::ranges::sentinel_t<R>;31 32 Sentinel s1 = {};33 assert(!s1.base().b);34 }35 return true;36}37 38int main(int, char**) {39 test();40 static_assert(test());41 42 return 0;43}44