1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // type_traits
11
12 // rank
13
14 #include <type_traits>
15
16 #include "test_macros.h"
17
18 template <class T, unsigned A>
test_rank()19 void test_rank()
20 {
21 static_assert( std::rank<T>::value == A, "");
22 static_assert( std::rank<const T>::value == A, "");
23 static_assert( std::rank<volatile T>::value == A, "");
24 static_assert( std::rank<const volatile T>::value == A, "");
25 #if TEST_STD_VER > 14
26 static_assert( std::rank_v<T> == A, "");
27 static_assert( std::rank_v<const T> == A, "");
28 static_assert( std::rank_v<volatile T> == A, "");
29 static_assert( std::rank_v<const volatile T> == A, "");
30 #endif
31 }
32
33 class Class
34 {
35 public:
36 ~Class();
37 };
38
main()39 int main()
40 {
41 test_rank<void, 0>();
42 test_rank<int&, 0>();
43 test_rank<Class, 0>();
44 test_rank<int*, 0>();
45 test_rank<const int*, 0>();
46 test_rank<int, 0>();
47 test_rank<double, 0>();
48 test_rank<bool, 0>();
49 test_rank<unsigned, 0>();
50
51 test_rank<char[3], 1>();
52 test_rank<char[][3], 2>();
53 test_rank<char[][4][3], 3>();
54 }
55