blob: a89ee7d4e4903524211fd82ec2977a1c71191999 [file] [log] [blame]
Howard Hinnant1468b662010-11-19 22:17:28 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// type_traits
11
12// is_move_assignable
13
14#include <type_traits>
15
Marshall Clow933afa92013-07-04 00:10:01 +000016template <class T>
17void test_is_move_assignable()
18{
Dan Albert1d4a1ed2016-05-25 22:36:09 -070019 static_assert( std::is_move_assignable<T>::value, "");
Marshall Clow933afa92013-07-04 00:10:01 +000020}
21
22template <class T>
23void test_is_not_move_assignable()
24{
Dan Albert1d4a1ed2016-05-25 22:36:09 -070025 static_assert(!std::is_move_assignable<T>::value, "");
Marshall Clow933afa92013-07-04 00:10:01 +000026}
27
Howard Hinnant1468b662010-11-19 22:17:28 +000028class Empty
29{
30};
31
32class NotEmpty
33{
34public:
35 virtual ~NotEmpty();
36};
37
38union Union {};
39
40struct bit_zero
41{
42 int : 0;
43};
44
45struct A
46{
47 A();
48};
49
50int main()
51{
Marshall Clow933afa92013-07-04 00:10:01 +000052 test_is_move_assignable<int> ();
53 test_is_move_assignable<A> ();
54 test_is_move_assignable<bit_zero> ();
55 test_is_move_assignable<Union> ();
56 test_is_move_assignable<NotEmpty> ();
57 test_is_move_assignable<Empty> ();
58
59#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
60 test_is_not_move_assignable<const int> ();
61 test_is_not_move_assignable<int[]> ();
62 test_is_not_move_assignable<int[3]> ();
Marshall Clow933afa92013-07-04 00:10:01 +000063#endif
64 test_is_not_move_assignable<void> ();
Howard Hinnant1468b662010-11-19 22:17:28 +000065}