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 // remove_reference
13 
14 #include <type_traits>
15 
16 template <class T, class U>
test_remove_reference()17 void test_remove_reference()
18 {
19     static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
20 #if _LIBCPP_STD_VER > 11
21     static_assert((std::is_same<std::remove_reference_t<T>, U>::value), "");
22 #endif
23 }
24 
main()25 int main()
26 {
27     test_remove_reference<void, void>();
28     test_remove_reference<int, int>();
29     test_remove_reference<int[3], int[3]>();
30     test_remove_reference<int*, int*>();
31     test_remove_reference<const int*, const int*>();
32 
33     test_remove_reference<int&, int>();
34     test_remove_reference<const int&, const int>();
35     test_remove_reference<int(&)[3], int[3]>();
36     test_remove_reference<int*&, int*>();
37     test_remove_reference<const int*&, const int*>();
38 
39 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
40     test_remove_reference<int&&, int>();
41     test_remove_reference<const int&&, const int>();
42     test_remove_reference<int(&&)[3], int[3]>();
43     test_remove_reference<int*&&, int*>();
44     test_remove_reference<const int*&&, const int*>();
45 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
46 }
47