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_nothrow_copy_assignable.pass.cpp
blob61852ba698b1877511c2becee0025c5abe894292
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_nothrow_copy_assignable
13 #include <type_traits>
14 #include "test_macros.h"
16 #include "common.h"
18 template <class T>
19 void test_has_nothrow_assign()
21 static_assert( std::is_nothrow_copy_assignable<T>::value, "");
22 #if TEST_STD_VER > 14
23 static_assert( std::is_nothrow_copy_assignable_v<T>, "");
24 #endif
27 template <class T>
28 void test_has_not_nothrow_assign()
30 static_assert(!std::is_nothrow_copy_assignable<T>::value, "");
31 #if TEST_STD_VER > 14
32 static_assert(!std::is_nothrow_copy_assignable_v<T>, "");
33 #endif
36 int main(int, char**)
38 test_has_nothrow_assign<int&>();
39 test_has_nothrow_assign<Union>();
40 test_has_nothrow_assign<Empty>();
41 test_has_nothrow_assign<int>();
42 test_has_nothrow_assign<double>();
43 test_has_nothrow_assign<int*>();
44 test_has_nothrow_assign<const int*>();
45 test_has_nothrow_assign<NotEmpty>();
46 test_has_nothrow_assign<bit_zero>();
48 // TODO: enable the test for GCC once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is resolved
49 #if TEST_STD_VER >= 11 && !defined(TEST_COMPILER_GCC)
50 test_has_not_nothrow_assign<TrivialNotNoexcept>();
51 #endif
52 test_has_not_nothrow_assign<const int>();
53 test_has_not_nothrow_assign<void>();
54 test_has_not_nothrow_assign<A>();
57 return 0;