• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "test_macros.h"
16 
17 template <class T, class U>
test_remove_reference()18 void test_remove_reference()
19 {
20     static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
21 #if TEST_STD_VER > 11
22     static_assert((std::is_same<std::remove_reference_t<T>, U>::value), "");
23 #endif
24 }
25 
main()26 int main()
27 {
28     test_remove_reference<void, void>();
29     test_remove_reference<int, int>();
30     test_remove_reference<int[3], int[3]>();
31     test_remove_reference<int*, int*>();
32     test_remove_reference<const int*, const int*>();
33 
34     test_remove_reference<int&, int>();
35     test_remove_reference<const int&, const int>();
36     test_remove_reference<int(&)[3], int[3]>();
37     test_remove_reference<int*&, int*>();
38     test_remove_reference<const int*&, const int*>();
39 
40 #if TEST_STD_VER >= 11
41     test_remove_reference<int&&, int>();
42     test_remove_reference<const int&&, const int>();
43     test_remove_reference<int(&&)[3], int[3]>();
44     test_remove_reference<int*&&, int*>();
45     test_remove_reference<const int*&&, const int*>();
46 #endif
47 }
48