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