| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // type_traits |
| 10 | |
| 11 | // remove_reference |
| 12 | |
| 13 | #include <type_traits> |
| 14 | #include "test_macros.h" |
| 15 | |
| 16 | template <class T, class U> |
| 17 | void test_remove_reference() |
| 18 | { |
| 19 | ASSERT_SAME_TYPE(U, typename std::remove_reference<T>::type); |
| 20 | #if TEST_STD_VER > 11 |
| 21 | ASSERT_SAME_TYPE(U, std::remove_reference_t<T>); |
| 22 | #endif |
| 23 | } |
| 24 | |
| 25 | int main(int, char**) |
| 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 | test_remove_reference<int&&, int>(); |
| 40 | test_remove_reference<const int&&, const int>(); |
| 41 | test_remove_reference<int(&&)[3], int[3]>(); |
| 42 | test_remove_reference<int*&&, int*>(); |
| 43 | test_remove_reference<const int*&&, const int*>(); |
| 44 | |
| 45 | return 0; |
| 46 | } |
| 47 | |