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 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
10 | |
11 | // type_traits |
12 | |
13 | // remove_cvref |
14 | |
15 | #include <type_traits> |
16 | |
17 | #include "test_macros.h" |
18 | |
19 | template <class T, class U> |
20 | void test_remove_cvref() |
21 | { |
22 | ASSERT_SAME_TYPE(U, typename std::remove_cvref<T>::type); |
23 | ASSERT_SAME_TYPE(U, std::remove_cvref_t<T>); |
24 | } |
25 | |
26 | int main(int, char**) |
27 | { |
28 | test_remove_cvref<void, void>(); |
29 | test_remove_cvref<int, int>(); |
30 | test_remove_cvref<const int, int>(); |
31 | test_remove_cvref<const volatile int, int>(); |
32 | test_remove_cvref<volatile int, int>(); |
33 | |
34 | // Doesn't decay |
35 | test_remove_cvref<int[3], int[3]>(); |
36 | test_remove_cvref<int const [3], int[3]>(); |
37 | test_remove_cvref<int volatile [3], int[3]>(); |
38 | test_remove_cvref<int const volatile [3], int[3]>(); |
39 | test_remove_cvref<void(), void ()>(); |
40 | |
41 | test_remove_cvref<int &, int>(); |
42 | test_remove_cvref<const int &, int>(); |
43 | test_remove_cvref<const volatile int &, int>(); |
44 | test_remove_cvref<volatile int &, int>(); |
45 | |
46 | test_remove_cvref<int*, int*>(); |
47 | test_remove_cvref<int(int) const, int(int) const>(); |
48 | test_remove_cvref<int(int) volatile, int(int) volatile>(); |
49 | test_remove_cvref<int(int) &, int(int) &>(); |
50 | test_remove_cvref<int(int) &&, int(int) &&>(); |
51 | |
52 | return 0; |
53 | } |
54 | |