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>
25 template <class T, class U>
26 void test_is_assignable()
28 static_assert(( std::is_assignable<T, U>::value), "");
31 template <class T, class U>
32 void test_is_not_assignable()
34 static_assert((!std::is_assignable<T, U>::value), "");
39 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
57 test_is_assignable<int&, int&> ();
58 test_is_assignable<int&, int> ();
59 test_is_assignable<int&, double> ();
60 test_is_assignable<B, A> ();
61 test_is_assignable<void*&, void*> ();
63 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
64 test_is_assignable<E, int> ();
66 test_is_not_assignable<int, int&> ();
67 test_is_not_assignable<int, int> ();
69 test_is_not_assignable<A, B> ();
70 test_is_not_assignable<void, const void> ();
71 test_is_not_assignable<const void, const void> ();
72 test_is_not_assignable<int(), int> ();
74 // pointer to incomplete template type
75 test_is_assignable<X<D>*&, X<D>*> ();