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_copy_assignable.pass.cpp
blob3f10907a4aaca364148fb95aa7d0b8fe0cbb2486
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_copy_assignable
13 #include <type_traits>
14 #include "test_macros.h"
16 template <class T>
17 void test_is_copy_assignable()
19 static_assert(( std::is_copy_assignable<T>::value), "");
20 #if TEST_STD_VER > 14
21 static_assert(( std::is_copy_assignable_v<T>), "");
22 #endif
25 template <class T>
26 void test_is_not_copy_assignable()
28 static_assert((!std::is_copy_assignable<T>::value), "");
29 #if TEST_STD_VER > 14
30 static_assert((!std::is_copy_assignable_v<T>), "");
31 #endif
34 class Empty
38 class NotEmpty
40 public:
41 virtual ~NotEmpty();
44 union Union {};
46 struct bit_zero
48 int : 0;
51 struct A
53 A();
56 class B
58 B& operator=(const B&);
61 struct C
63 void operator=(C&); // not const
66 int main(int, char**)
68 test_is_copy_assignable<int> ();
69 test_is_copy_assignable<int&> ();
70 test_is_copy_assignable<A> ();
71 test_is_copy_assignable<bit_zero> ();
72 test_is_copy_assignable<Union> ();
73 test_is_copy_assignable<NotEmpty> ();
74 test_is_copy_assignable<Empty> ();
76 #if TEST_STD_VER >= 11
77 test_is_not_copy_assignable<const int> ();
78 test_is_not_copy_assignable<int[]> ();
79 test_is_not_copy_assignable<int[3]> ();
80 test_is_not_copy_assignable<B> ();
81 #endif
82 test_is_not_copy_assignable<void> ();
83 test_is_not_copy_assignable<C> ();
85 return 0;