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 // friend constexpr bool operator==(const iterator& x, const sentinel& y);
13 
14 #include <ranges>
15 #include <cassert>
16 
17 #include "test_macros.h"
18 #include "../types.h"
19 
test()20 constexpr bool test() {
21   {
22     const std::ranges::iota_view<int, IntComparableWith<int>> io(0, IntComparableWith<int>(10));
23     auto iter = io.begin();
24     auto sent = io.end();
25     assert(iter != sent);
26     assert(iter + 10 == sent);
27   }
28   {
29     std::ranges::iota_view<int, IntComparableWith<int>> io(0, IntComparableWith<int>(10));
30     auto iter = io.begin();
31     auto sent = io.end();
32     assert(iter != sent);
33     assert(iter + 10 == sent);
34   }
35   {
36     const std::ranges::iota_view io(SomeInt(0), IntComparableWith(SomeInt(10)));
37     auto iter = io.begin();
38     auto sent = io.end();
39     assert(iter != sent);
40     assert(iter + 10 == sent);
41   }
42   {
43     std::ranges::iota_view io(SomeInt(0), IntComparableWith(SomeInt(10)));
44     auto iter = io.begin();
45     auto sent = io.end();
46     assert(iter != sent);
47     assert(iter + 10 == sent);
48   }
49 
50   return true;
51 }
52 
main(int,char **)53 int main(int, char**) {
54   test();
55   static_assert(test());
56 
57   return 0;
58 }
59