1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 #include <type_traits>
15 #include "test_macros.h"
26 template <class T, class U>
27 void test_is_assignable()
29 static_assert(( std::is_assignable<T, U>::value), "");
31 static_assert( std::is_assignable_v<T, U>, "");
35 template <class T, class U>
36 void test_is_not_assignable()
38 static_assert((!std::is_assignable<T, U>::value), "");
40 static_assert( !std::is_assignable_v<T, U>, "");
46 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
64 test_is_assignable<int&, int&> ();
65 test_is_assignable<int&, int> ();
66 test_is_assignable<int&, double> ();
67 test_is_assignable<B, A> ();
68 test_is_assignable<void*&, void*> ();
70 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
71 test_is_assignable<E, int> ();
73 test_is_not_assignable<int, int&> ();
74 test_is_not_assignable<int, int> ();
76 test_is_not_assignable<A, B> ();
77 test_is_not_assignable<void, const void> ();
78 test_is_not_assignable<const void, const void> ();
79 test_is_not_assignable<int(), int> ();
81 // pointer to incomplete template type
82 test_is_assignable<X<D>*&, X<D>*> ();