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//===----------------------------------------------------------------------===//
8
9// type_traits
10
11// has_nothrow_move_assign
12
13#include <type_traits>
14#include "test_macros.h"
15
16#include "common.h"
17
18template <class T>
19void test_has_nothrow_assign()
20{
21 static_assert( std::is_nothrow_move_assignable<T>::value, "");
22#if TEST_STD_VER > 14
23 static_assert( std::is_nothrow_move_assignable_v<T>, "");
24#endif
25}
26
27template <class T>
28void test_has_not_nothrow_assign()
29{
30 static_assert(!std::is_nothrow_move_assignable<T>::value, "");
31#if TEST_STD_VER > 14
32 static_assert(!std::is_nothrow_move_assignable_v<T>, "");
33#endif
34}
35
36int main(int, char**)
37{
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>();
47
48 test_has_not_nothrow_assign<void>();
49 test_has_not_nothrow_assign<A>();
50// TODO: enable the test for GCC once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is resolved
51#if TEST_STD_VER >= 11 && !defined(TEST_COMPILER_GCC)
52 test_has_not_nothrow_assign<TrivialNotNoexcept>();
53#endif
54
55 return 0;
56}
57

source code of libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp