1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
15 // constexpr S base() const;
21 #include "test_macros.h"
25 // The sentinel type is a value.
27 auto m
= std::move_sentinel
<int>(42);
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.
42 auto m
= std::move_sentinel
<const int*>(a
);
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*);
59 static_assert(test());