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