1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // type_traits
11 
12 // add_rvalue_reference
13 
14 #include <type_traits>
15 
16 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
17 
18 template <class T, class U>
test_add_rvalue_reference()19 void test_add_rvalue_reference()
20 {
21     static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), "");
22 #if _LIBCPP_STD_VER > 11
23     static_assert((std::is_same<std::add_rvalue_reference_t<T>, U>::value), "");
24 #endif
25 }
26 
27 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
28 
main()29 int main()
30 {
31 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
32     test_add_rvalue_reference<void, void>();
33     test_add_rvalue_reference<int, int&&>();
34     test_add_rvalue_reference<int[3], int(&&)[3]>();
35     test_add_rvalue_reference<int&, int&>();
36     test_add_rvalue_reference<const int&, const int&>();
37     test_add_rvalue_reference<int*, int*&&>();
38     test_add_rvalue_reference<const int*, const int*&&>();
39 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
40 }
41