| 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_pointer |
| 12 |
|
| 13 |
#include <type_traits> |
| 14 |
#include "test_macros.h" |
| 15 |
|
| 16 |
template <class T, class U> |
| 17 |
void test_remove_pointer() |
| 18 |
{ |
| 19 |
ASSERT_SAME_TYPE(U, typename std::remove_pointer<T>::type); |
| 20 |
#if TEST_STD_VER > 11 |
| 21 |
ASSERT_SAME_TYPE(U, std::remove_pointer_t<T>); |
| 22 |
#endif |
| 23 |
} |
| 24 |
|
| 25 |
int main(int, char**) |
| 26 |
{ |
| 27 |
test_remove_pointer<void, void>(); |
| 28 |
test_remove_pointer<int, int>(); |
| 29 |
test_remove_pointer<int[3], int[3]>(); |
| 30 |
test_remove_pointer<int*, int>(); |
| 31 |
test_remove_pointer<const int*, const int>(); |
| 32 |
test_remove_pointer<int**, int*>(); |
| 33 |
test_remove_pointer<int** const, int*>(); |
| 34 |
test_remove_pointer<int*const * , int* const>(); |
| 35 |
test_remove_pointer<const int** , const int*>(); |
| 36 |
|
| 37 |
test_remove_pointer<int&, int&>(); |
| 38 |
test_remove_pointer<const int&, const int&>(); |
| 39 |
test_remove_pointer<int(&)[3], int(&)[3]>(); |
| 40 |
test_remove_pointer<int(*)[3], int[3]>(); |
| 41 |
test_remove_pointer<int*&, int*&>(); |
| 42 |
test_remove_pointer<const int*&, const int*&>(); |
| 43 |
|
| 44 |
return 0; |
| 45 |
} |