blob: e8f08fdc398ad252818d140355bd08f4e987931f [file] [log] [blame]
Howard Hinnantc52f43e2010-08-22 00:59:46 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantc52f43e2010-08-22 00:59:46 +00007//
8//===----------------------------------------------------------------------===//
9
10// type_traits
11
12// add_rvalue_reference
13
14#include <type_traits>
15
Howard Hinnant73d21a42010-09-04 23:28:19 +000016#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantc52f43e2010-08-22 00:59:46 +000017
18template <class T, class U>
19void test_add_rvalue_reference()
20{
21 static_assert((std::is_same<typename std::add_rvalue_reference<T>::type, U>::value), "");
Dan Albert1d4a1ed2016-05-25 22:36:09 -070022#if _LIBCPP_STD_VER > 11
Marshall Clow933afa92013-07-04 00:10:01 +000023 static_assert((std::is_same<std::add_rvalue_reference_t<T>, U>::value), "");
24#endif
Howard Hinnantc52f43e2010-08-22 00:59:46 +000025}
26
Howard Hinnant73d21a42010-09-04 23:28:19 +000027#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantc52f43e2010-08-22 00:59:46 +000028
29int main()
30{
Howard Hinnant73d21a42010-09-04 23:28:19 +000031#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantc52f43e2010-08-22 00:59:46 +000032 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*&&>();
Dan Albert1d4a1ed2016-05-25 22:36:09 -070039#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantc52f43e2010-08-22 00:59:46 +000040}