remove_ref.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// type_traits
11
12// remove_reference
13
14#include <type_traits>
15
16template <class T, class U>
17void test_remove_reference()
18{
19    static_assert((std::is_same<typename std::remove_reference<T>::type, U>::value), "");
20}
21
22int main()
23{
24    test_remove_reference<void, void>();
25    test_remove_reference<int, int>();
26    test_remove_reference<int[3], int[3]>();
27    test_remove_reference<int*, int*>();
28    test_remove_reference<const int*, const int*>();
29
30    test_remove_reference<int&, int>();
31    test_remove_reference<const int&, const int>();
32    test_remove_reference<int(&)[3], int[3]>();
33    test_remove_reference<int*&, int*>();
34    test_remove_reference<const int*&, const int*>();
35
36#ifdef _LIBCPP_MOVE
37    test_remove_reference<int&&, int>();
38    test_remove_reference<const int&&, const int>();
39    test_remove_reference<int(&&)[3], int[3]>();
40    test_remove_reference<int*&&, int*>();
41    test_remove_reference<const int*&&, const int*>();
42#endif
43}
44