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 // UNSUPPORTED: c++03, c++11, c++14, c++17 10 11 // <iterator> 12 13 // move_sentinel 14 15 // constexpr move_sentinel(); 16 17 #include <iterator> 18 #include <cassert> 19 test()20constexpr bool test() 21 { 22 23 // The underlying sentinel is an integer. 24 { 25 std::move_sentinel<int> m; 26 assert(m.base() == 0); 27 } 28 29 // The underlying sentinel is a pointer. 30 { 31 std::move_sentinel<int*> m; 32 assert(m.base() == nullptr); 33 } 34 35 // The underlying sentinel is a user-defined type with an explicit default constructor. 36 { 37 struct S { 38 explicit S() = default; 39 int i = 3; 40 }; 41 std::move_sentinel<S> m; 42 assert(m.base().i == 3); 43 } 44 45 return true; 46 } 47 main(int,char **)48int main(int, char**) 49 { 50 test(); 51 static_assert(test()); 52 53 return 0; 54 } 55