1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // is_nothrow_assignable
13 #include <type_traits>
14 #include "test_macros.h"
16 template <class T
, class U
>
17 void test_is_nothrow_assignable()
19 static_assert(( std::is_nothrow_assignable
<T
, U
>::value
), "");
21 static_assert(( std::is_nothrow_assignable_v
<T
, U
>), "");
25 template <class T
, class U
>
26 void test_is_not_nothrow_assignable()
28 static_assert((!std::is_nothrow_assignable
<T
, U
>::value
), "");
30 static_assert((!std::is_nothrow_assignable_v
<T
, U
>), "");
45 void operator=(C
&); // not const
50 test_is_nothrow_assignable
<int&, int&> ();
51 test_is_nothrow_assignable
<int&, int> ();
52 #if TEST_STD_VER >= 11
53 test_is_nothrow_assignable
<int&, double> ();
56 test_is_not_nothrow_assignable
<int, int&> ();
57 test_is_not_nothrow_assignable
<int, int> ();
58 test_is_not_nothrow_assignable
<B
, A
> ();
59 test_is_not_nothrow_assignable
<A
, B
> ();
60 test_is_not_nothrow_assignable
<C
, C
&> ();