[libcxx][test] Fix a test for the range of file offsets on ARMv7 Linux targets. ...
[llvm-project.git] / libcxx / test / std / iterators / predef.iterators / move.iterators / move.sentinel / base.pass.cpp
blobb3b0293c3d48b45002f3e032eff229a9ddc3caea
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 // <iterator>
13 // move_sentinel
15 // constexpr S base() const;
17 #include <cassert>
18 #include <iterator>
19 #include <utility>
21 #include "test_macros.h"
23 constexpr bool test()
25 // The sentinel type is a value.
27 auto m = std::move_sentinel<int>(42);
28 const auto& cm = m;
29 assert(m.base() == 42);
30 assert(cm.base() == 42);
31 assert(std::move(m).base() == 42);
32 assert(std::move(cm).base() == 42);
33 ASSERT_SAME_TYPE(decltype(m.base()), int);
34 ASSERT_SAME_TYPE(decltype(cm.base()), int);
35 ASSERT_SAME_TYPE(decltype(std::move(m).base()), int);
36 ASSERT_SAME_TYPE(decltype(std::move(cm).base()), int);
39 // The sentinel type is a pointer.
41 int a[] = {1, 2, 3};
42 auto m = std::move_sentinel<const int*>(a);
43 const auto& cm = m;
44 assert(m.base() == a);
45 assert(cm.base() == a);
46 assert(std::move(m).base() == a);
47 assert(std::move(cm).base() == a);
48 ASSERT_SAME_TYPE(decltype(m.base()), const int*);
49 ASSERT_SAME_TYPE(decltype(cm.base()), const int*);
50 ASSERT_SAME_TYPE(decltype(std::move(m).base()), const int*);
51 ASSERT_SAME_TYPE(decltype(std::move(cm).base()), const int*);
53 return true;
56 int main(int, char**)
58 test();
59 static_assert(test());
61 return 0;