Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / meta / meta.unary / meta.unary.prop / is_trivially_move_assignable.pass.cpp
blobb599ae56f07666624c8be4101f5e0d711f3edacf
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 // type_traits
11 // is_trivially_move_assignable
13 #include <type_traits>
14 #include "test_macros.h"
16 template <class T>
17 void test_has_trivial_assign()
19 static_assert( std::is_trivially_move_assignable<T>::value, "");
20 #if TEST_STD_VER > 14
21 static_assert( std::is_trivially_move_assignable_v<T>, "");
22 #endif
25 template <class T>
26 void test_has_not_trivial_assign()
28 static_assert(!std::is_trivially_move_assignable<T>::value, "");
29 #if TEST_STD_VER > 14
30 static_assert(!std::is_trivially_move_assignable_v<T>, "");
31 #endif
34 class Empty
38 class NotEmpty
40 virtual ~NotEmpty();
43 union Union {};
45 struct bit_zero
47 int : 0;
50 class Abstract
52 virtual ~Abstract() = 0;
55 struct A
57 A& operator=(const A&);
60 int main(int, char**)
62 test_has_trivial_assign<int&>();
63 test_has_trivial_assign<Union>();
64 test_has_trivial_assign<Empty>();
65 test_has_trivial_assign<int>();
66 test_has_trivial_assign<double>();
67 test_has_trivial_assign<int*>();
68 test_has_trivial_assign<const int*>();
69 test_has_trivial_assign<bit_zero>();
71 test_has_not_trivial_assign<void>();
72 test_has_not_trivial_assign<A>();
73 test_has_not_trivial_assign<NotEmpty>();
74 test_has_not_trivial_assign<Abstract>();
75 test_has_not_trivial_assign<const Empty>();
78 return 0;