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_move_constructible.pass.cpp
blobdc10ec37b0fcd86d8a2787e65ead6966bd0840ad
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 // has_nothrow_move_constructor
13 #include <type_traits>
14 #include "test_macros.h"
16 #include "common.h"
18 template <class T>
19 void test_is_nothrow_move_constructible()
21 static_assert( std::is_nothrow_move_constructible<T>::value, "");
22 static_assert( std::is_nothrow_move_constructible<const T>::value, "");
23 #if TEST_STD_VER > 14
24 static_assert( std::is_nothrow_move_constructible_v<T>, "");
25 static_assert( std::is_nothrow_move_constructible_v<const T>, "");
26 #endif
29 template <class T>
30 void test_has_not_nothrow_move_constructor()
32 static_assert(!std::is_nothrow_move_constructible<T>::value, "");
33 static_assert(!std::is_nothrow_move_constructible<const T>::value, "");
34 static_assert(!std::is_nothrow_move_constructible<volatile T>::value, "");
35 static_assert(!std::is_nothrow_move_constructible<const volatile T>::value, "");
36 #if TEST_STD_VER > 14
37 static_assert(!std::is_nothrow_move_constructible_v<T>, "");
38 static_assert(!std::is_nothrow_move_constructible_v<const T>, "");
39 static_assert(!std::is_nothrow_move_constructible_v<volatile T>, "");
40 static_assert(!std::is_nothrow_move_constructible_v<const volatile T>, "");
41 #endif
44 int main(int, char**)
46 test_has_not_nothrow_move_constructor<void>();
47 test_has_not_nothrow_move_constructor<A>();
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_move_constructor<TrivialNotNoexcept>();
51 #endif
53 test_is_nothrow_move_constructible<int&>();
54 test_is_nothrow_move_constructible<Union>();
55 test_is_nothrow_move_constructible<Empty>();
56 test_is_nothrow_move_constructible<int>();
57 test_is_nothrow_move_constructible<double>();
58 test_is_nothrow_move_constructible<int*>();
59 test_is_nothrow_move_constructible<const int*>();
60 test_is_nothrow_move_constructible<bit_zero>();
62 return 0;