[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / iterators / predef.iterators / iterators.common / ctor.iter.pass.cpp
blob57d89e3c2e1b863b4d5c697f124c226b4177f6c6
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(I i);
13 #include <iterator>
14 #include <cassert>
16 #include "test_iterators.h"
18 template<class It>
19 constexpr bool test() {
20 using CommonIt = std::common_iterator<It, sentinel_wrapper<It>>;
21 int a[] = {1,2,3};
22 It it = It(a);
23 CommonIt lv = CommonIt(it);
24 assert(&*lv == a);
25 CommonIt rv = CommonIt(std::move(it));
26 assert(&*rv == a);
28 return true;
31 int main(int, char**) {
32 test<cpp17_input_iterator<int*>>();
33 test<forward_iterator<int*>>();
34 test<bidirectional_iterator<int*>>();
35 test<random_access_iterator<int*>>();
36 test<contiguous_iterator<int*>>();
37 test<int*>();
38 test<const int*>();
40 static_assert(test<cpp17_input_iterator<int*>>());
41 static_assert(test<forward_iterator<int*>>());
42 static_assert(test<bidirectional_iterator<int*>>());
43 static_assert(test<random_access_iterator<int*>>());
44 static_assert(test<contiguous_iterator<int*>>());
45 static_assert(test<int*>());
46 static_assert(test<const int*>());
48 return 0;