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 // template<class T>
12 // concept move_constructible;
13 
14 #include <concepts>
15 #include <type_traits>
16 
17 #include "type_classification/moveconstructible.h"
18 
19 static_assert(std::move_constructible<int>);
20 static_assert(std::move_constructible<int*>);
21 static_assert(std::move_constructible<int&>);
22 static_assert(std::move_constructible<int&&>);
23 static_assert(std::move_constructible<const int>);
24 static_assert(std::move_constructible<const int&>);
25 static_assert(std::move_constructible<const int&&>);
26 static_assert(std::move_constructible<volatile int>);
27 static_assert(std::move_constructible<volatile int&>);
28 static_assert(std::move_constructible<volatile int&&>);
29 static_assert(std::move_constructible<int (*)()>);
30 static_assert(std::move_constructible<int (&)()>);
31 static_assert(std::move_constructible<HasDefaultOps>);
32 static_assert(std::move_constructible<CustomMoveCtor>);
33 static_assert(std::move_constructible<MoveOnly>);
34 static_assert(std::move_constructible<const CustomMoveCtor&>);
35 static_assert(std::move_constructible<volatile CustomMoveCtor&>);
36 static_assert(std::move_constructible<const CustomMoveCtor&&>);
37 static_assert(std::move_constructible<volatile CustomMoveCtor&&>);
38 static_assert(std::move_constructible<CustomMoveAssign>);
39 static_assert(std::move_constructible<const CustomMoveAssign&>);
40 static_assert(std::move_constructible<volatile CustomMoveAssign&>);
41 static_assert(std::move_constructible<const CustomMoveAssign&&>);
42 static_assert(std::move_constructible<volatile CustomMoveAssign&&>);
43 static_assert(std::move_constructible<int HasDefaultOps::*>);
44 static_assert(std::move_constructible<void (HasDefaultOps::*)(int)>);
45 static_assert(std::move_constructible<MemberLvalueReference>);
46 static_assert(std::move_constructible<MemberRvalueReference>);
47 
48 static_assert(!std::move_constructible<void>);
49 static_assert(!std::move_constructible<const CustomMoveCtor>);
50 static_assert(!std::move_constructible<volatile CustomMoveCtor>);
51 static_assert(!std::move_constructible<const CustomMoveAssign>);
52 static_assert(!std::move_constructible<volatile CustomMoveAssign>);
53 static_assert(!std::move_constructible<int[10]>);
54 static_assert(!std::move_constructible<DeletedMoveCtor>);
55 static_assert(!std::move_constructible<ImplicitlyDeletedMoveCtor>);
56 static_assert(!std::move_constructible<DeletedMoveAssign>);
57 static_assert(!std::move_constructible<ImplicitlyDeletedMoveAssign>);
58 
59 static_assert(std::move_constructible<DeletedMoveCtor&>);
60 static_assert(std::move_constructible<DeletedMoveCtor&&>);
61 static_assert(std::move_constructible<const DeletedMoveCtor&>);
62 static_assert(std::move_constructible<const DeletedMoveCtor&&>);
63 static_assert(std::move_constructible<ImplicitlyDeletedMoveCtor&>);
64 static_assert(std::move_constructible<ImplicitlyDeletedMoveCtor&&>);
65 static_assert(std::move_constructible<const ImplicitlyDeletedMoveCtor&>);
66 static_assert(std::move_constructible<const ImplicitlyDeletedMoveCtor&&>);
67 static_assert(std::move_constructible<DeletedMoveAssign&>);
68 static_assert(std::move_constructible<DeletedMoveAssign&&>);
69 static_assert(std::move_constructible<const DeletedMoveAssign&>);
70 static_assert(std::move_constructible<const DeletedMoveAssign&&>);
71 static_assert(std::move_constructible<ImplicitlyDeletedMoveAssign&>);
72 static_assert(std::move_constructible<ImplicitlyDeletedMoveAssign&&>);
73 static_assert(std::move_constructible<const ImplicitlyDeletedMoveAssign&>);
74 static_assert(std::move_constructible<const ImplicitlyDeletedMoveAssign&&>);
75 
76 static_assert(!std::move_constructible<NonMovable>);
77 static_assert(!std::move_constructible<DerivedFromNonMovable>);
78 static_assert(!std::move_constructible<HasANonMovable>);
79