• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>
test_decay()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 
main(int,char **)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[3], int*>();
33     test_decay<const int[3], const int*>();
34     test_decay<void(), void (*)()>();
35 #if TEST_STD_VER > 11
36     test_decay<int(int) const, int(int) const>();
37     test_decay<int(int) volatile, int(int) volatile>();
38     test_decay<int(int)  &, int(int)  &>();
39     test_decay<int(int) &&, int(int) &&>();
40 #endif
41 
42   return 0;
43 }
44