ELF: Have __rela_iplt_{start,end} surround .rela.iplt with --pack-dyn-relocs=android.
[llvm-project.git] / libcxx / test / std / iterators / predef.iterators / iterators.common / ctor.sentinel.pass.cpp
blob6e1c2130c9c919d18491b7fdfa7dcd47d98c75f1
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // constexpr common_iterator(S s);
13 #include <iterator>
14 #include <cassert>
15 #include <type_traits>
17 #include "test_iterators.h"
19 template<class It>
20 constexpr bool test() {
21 using Sent = sentinel_wrapper<It>;
22 using CommonIt = std::common_iterator<It, Sent>;
23 int a[] = {1,2,3};
24 It it = It(a);
25 Sent sent = Sent(It(a+1));
27 CommonIt lv = CommonIt(sent);
28 assert(lv == CommonIt(sent));
29 assert(lv != CommonIt(it));
30 if (!std::is_constant_evaluated()) {
31 assert(lv == std::next(CommonIt(it)));
34 CommonIt rv = CommonIt(std::move(sent));
35 assert(rv == CommonIt(sent));
36 assert(rv != CommonIt(it));
37 if (!std::is_constant_evaluated()) {
38 assert(rv == std::next(CommonIt(it)));
41 return true;
44 int main(int, char**) {
45 test<cpp17_input_iterator<int*>>();
46 test<forward_iterator<int*>>();
47 test<bidirectional_iterator<int*>>();
48 test<random_access_iterator<int*>>();
49 test<contiguous_iterator<int*>>();
50 test<int*>();
51 test<const int*>();
53 static_assert(test<cpp17_input_iterator<int*>>());
54 static_assert(test<forward_iterator<int*>>());
55 static_assert(test<bidirectional_iterator<int*>>());
56 static_assert(test<random_access_iterator<int*>>());
57 static_assert(test<contiguous_iterator<int*>>());
58 static_assert(test<int*>());
59 static_assert(test<const int*>());
61 return 0;