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 | // <iterator> |
10 | |
11 | #include <iterator> |
12 | |
13 | #include "test_macros.h" |
14 | |
15 | struct Incomplete; |
16 | template<class T> struct Holder { T t; }; |
17 | |
18 | template<class> |
19 | struct Intable { |
20 | operator int() const { return 1; } |
21 | }; |
22 | |
23 | int main(int, char**) { |
24 | Holder<Incomplete> *a[2] = {}; |
25 | Holder<Incomplete> **p = a; |
26 | #if TEST_STD_VER >= 17 |
27 | p = std::next(p); |
28 | p = std::prev(p); |
29 | p = std::next(p, 2); |
30 | p = std::prev(p, 2); |
31 | #endif |
32 | std::advance(p, Intable<Holder<Incomplete> >()); |
33 | (void)std::distance(p, p); |
34 | |
35 | return 0; |
36 | } |
37 | |