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, c++20 |
10 | |
11 | // constexpr iterator& operator-=(difference_type n); |
12 | |
13 | #include <ranges> |
14 | #include <cassert> |
15 | #include <concepts> |
16 | |
17 | constexpr bool test() { |
18 | using Iter = std::ranges::iterator_t<std::ranges::repeat_view<int>>; |
19 | std::ranges::repeat_view<int> v(10); |
20 | auto iter = v.begin() + 10; |
21 | iter -= 5; |
22 | assert(iter == v.begin() + 5); |
23 | |
24 | static_assert(std::same_as<decltype(iter -= 5), Iter&>); |
25 | |
26 | return true; |
27 | } |
28 | |
29 | int main(int, char**) { |
30 | test(); |
31 | static_assert(test()); |
32 | |
33 | return 0; |
34 | } |
35 | |