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 // sentinel() = default;
13 // constexpr explicit sentinel(sentinel_t<Base> end);
14 // constexpr sentinel(sentinel<!Const> s)
15 // requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
16
17 #include <ranges>
18 #include <cassert>
19
20 #include "test_macros.h"
21 #include "test_iterators.h"
22 #include "../types.h"
23
test()24 constexpr bool test() {
25 int buffer[8] = {1, 2, 3, 4, 5, 6, 7, 8};
26 {
27 std::ranges::take_view<MoveOnlyView> tv(MoveOnlyView(buffer), 4);
28 std::same_as<sentinel_wrapper<int*>> auto sw1 = tv.end().base();
29 assert(base(sw1) == buffer + 8);
30 std::same_as<sentinel_wrapper<int*>> auto sw2 = std::as_const(tv).end().base();
31 assert(base(sw2) == buffer + 8);
32 }
33 return true;
34 }
35
main(int,char **)36 int main(int, char**) {
37 test();
38 static_assert(test());
39
40 return 0;
41 }
42