| 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 | // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS |
| 10 | |
| 11 | // <iterator> |
| 12 | |
| 13 | // move_iterator |
| 14 | |
| 15 | // pointer operator->() const; |
| 16 | // |
| 17 | // constexpr in C++17 |
| 18 | // deprecated in C++20 |
| 19 | |
| 20 | #include <iterator> |
| 21 | #include <cassert> |
| 22 | |
| 23 | #include "test_macros.h" |
| 24 | |
| 25 | TEST_CONSTEXPR_CXX17 bool test() |
| 26 | { |
| 27 | char a[] = "123456789" ; |
| 28 | std::move_iterator<char *> it1 = std::make_move_iterator(a); |
| 29 | std::move_iterator<char *> it2 = std::make_move_iterator(a + 1); |
| 30 | assert(it1.operator->() == a); |
| 31 | assert(it2.operator->() == a + 1); |
| 32 | |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | int main(int, char**) |
| 37 | { |
| 38 | test(); |
| 39 | #if TEST_STD_VER > 14 |
| 40 | static_assert(test()); |
| 41 | #endif |
| 42 | |
| 43 | return 0; |
| 44 | } |
| 45 | |