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