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 //===----------------------------------------------------------------------===//
13 #include <type_traits>
14 #include "test_macros.h"
25 template <class T
, class U
>
26 void test_is_assignable()
28 static_assert(( std::is_assignable
<T
, U
>::value
), "");
30 static_assert( std::is_assignable_v
<T
, U
>, "");
34 template <class T
, class U
>
35 void test_is_not_assignable()
37 static_assert((!std::is_assignable
<T
, U
>::value
), "");
39 static_assert( !std::is_assignable_v
<T
, U
>, "");
45 #if TEST_STD_VER >= 11
63 test_is_assignable
<int&, int&> ();
64 test_is_assignable
<int&, int> ();
65 test_is_assignable
<int&, double> ();
66 test_is_assignable
<B
, A
> ();
67 test_is_assignable
<void*&, void*> ();
69 #if TEST_STD_VER >= 11
70 test_is_assignable
<E
, int> ();
72 test_is_not_assignable
<int, int&> ();
73 test_is_not_assignable
<int, int> ();
75 test_is_not_assignable
<A
, B
> ();
76 test_is_not_assignable
<void, const void> ();
77 test_is_not_assignable
<const void, const void> ();
78 test_is_not_assignable
<int(), int> ();
80 // pointer to incomplete template type
81 test_is_assignable
<X
<D
>*&, X
<D
>*> ();