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