blob: 05246b1f10a3dc6058bff12ca457e317bdaf96bf [file] [log] [blame]
Howard Hinnantc52f43e2010-08-22 00:59:46 +00001//===----------------------------------------------------------------------===//
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
Howard Hinnant73d21a42010-09-04 23:28:19 +000036#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantc52f43e2010-08-22 00:59:46 +000037 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*>();
Howard Hinnant73d21a42010-09-04 23:28:19 +000042#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantc52f43e2010-08-22 00:59:46 +000043}