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_constructible.pass.cpp
blobf64c40e862b0b8c2f76e66ec5104d830afbc474b
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_constructible
13 #include <type_traits>
14 #include "test_macros.h"
16 template <class T>
17 void test_is_copy_constructible()
19 static_assert( std::is_copy_constructible<T>::value, "");
20 #if TEST_STD_VER > 14
21 static_assert( std::is_copy_constructible_v<T>, "");
22 #endif
25 template <class T>
26 void test_is_not_copy_constructible()
28 static_assert(!std::is_copy_constructible<T>::value, "");
29 #if TEST_STD_VER > 14
30 static_assert(!std::is_copy_constructible_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 class Abstract
53 public:
54 virtual ~Abstract() = 0;
57 struct A
59 A(const A&);
62 class B
64 B(const B&);
67 struct C
69 C(C&); // not const
70 void operator=(C&); // not const
73 int main(int, char**)
75 test_is_copy_constructible<A>();
76 test_is_copy_constructible<int&>();
77 test_is_copy_constructible<Union>();
78 test_is_copy_constructible<Empty>();
79 test_is_copy_constructible<int>();
80 test_is_copy_constructible<double>();
81 test_is_copy_constructible<int*>();
82 test_is_copy_constructible<const int*>();
83 test_is_copy_constructible<NotEmpty>();
84 test_is_copy_constructible<bit_zero>();
86 test_is_not_copy_constructible<char[3]>();
87 test_is_not_copy_constructible<char[]>();
88 test_is_not_copy_constructible<void>();
89 test_is_not_copy_constructible<Abstract>();
90 test_is_not_copy_constructible<C>();
91 #if TEST_STD_VER >= 11
92 test_is_not_copy_constructible<B>();
93 #endif
95 return 0;