1*94461822SHui Xie //===----------------------------------------------------------------------===//
2*94461822SHui Xie //
3*94461822SHui Xie // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*94461822SHui Xie // See https://llvm.org/LICENSE.txt for license information.
5*94461822SHui Xie // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*94461822SHui Xie //
7*94461822SHui Xie //===----------------------------------------------------------------------===//
8*94461822SHui Xie
9*94461822SHui Xie // UNSUPPORTED: c++03, c++11, c++14, c++17
10*94461822SHui Xie
11*94461822SHui Xie // constexpr sentinel_t<Base> base() const;
12*94461822SHui Xie
13*94461822SHui Xie #include <cassert>
14*94461822SHui Xie #include <ranges>
15*94461822SHui Xie #include <tuple>
16*94461822SHui Xie #include <type_traits>
17*94461822SHui Xie #include <utility>
18*94461822SHui Xie
19*94461822SHui Xie struct Sent {
20*94461822SHui Xie int i;
21*94461822SHui Xie
operator ==(std::tuple<int> *,const Sent &)22*94461822SHui Xie friend constexpr bool operator==(std::tuple<int>*, const Sent&) { return true; }
23*94461822SHui Xie };
24*94461822SHui Xie
test()25*94461822SHui Xie constexpr bool test() {
26*94461822SHui Xie using BaseRange = std::ranges::subrange<std::tuple<int>*, Sent>;
27*94461822SHui Xie using EleRange = std::ranges::elements_view<BaseRange, 0>;
28*94461822SHui Xie using EleSent = std::ranges::sentinel_t<EleRange>;
29*94461822SHui Xie
30*94461822SHui Xie const EleSent st{Sent{5}};
31*94461822SHui Xie std::same_as<Sent> decltype(auto) base = st.base();
32*94461822SHui Xie assert(base.i == 5);
33*94461822SHui Xie
34*94461822SHui Xie return true;
35*94461822SHui Xie }
36*94461822SHui Xie
main(int,char **)37*94461822SHui Xie int main(int, char**) {
38*94461822SHui Xie test();
39*94461822SHui Xie static_assert(test());
40*94461822SHui Xie return 0;
41*94461822SHui Xie }
42