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 // rank
12
13 #include <type_traits>
14
15 #include "test_macros.h"
16
17 template <class T, unsigned A>
test_rank()18 void test_rank()
19 {
20 static_assert( std::rank<T>::value == A, "");
21 static_assert( std::rank<const T>::value == A, "");
22 static_assert( std::rank<volatile T>::value == A, "");
23 static_assert( std::rank<const volatile T>::value == A, "");
24 #if TEST_STD_VER > 14
25 static_assert( std::rank_v<T> == A, "");
26 static_assert( std::rank_v<const T> == A, "");
27 static_assert( std::rank_v<volatile T> == A, "");
28 static_assert( std::rank_v<const volatile T> == A, "");
29 #endif
30 }
31
32 class Class
33 {
34 public:
35 ~Class();
36 };
37
main(int,char **)38 int main(int, char**)
39 {
40 test_rank<void, 0>();
41 test_rank<int&, 0>();
42 test_rank<Class, 0>();
43 test_rank<int*, 0>();
44 test_rank<const int*, 0>();
45 test_rank<int, 0>();
46 test_rank<double, 0>();
47 test_rank<bool, 0>();
48 test_rank<unsigned, 0>();
49
50 test_rank<char[3], 1>();
51 test_rank<char[][3], 2>();
52 test_rank<char[][4][3], 3>();
53
54 return 0;
55 }
56