blob: 06f66a92c7c3b3af23154299776a0ef0ce5aba43 [file] [log] [blame]
Howard Hinnantc52f43e2010-08-22 00:59:46 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantc52f43e2010-08-22 00:59:46 +00007//
8//===----------------------------------------------------------------------===//
9
10// type_traits
11
12// rank
13
14#include <type_traits>
15
16template <class T, unsigned A>
17void test_rank()
18{
19 static_assert( std::rank<T>::value == A, "");
20 static_assert( std::rank<const T>::value == A, "");
21 static_assert( std::rank<volatile T>::value == A, "");
22 static_assert( std::rank<const volatile T>::value == A, "");
23}
24
25class Class
26{
27public:
28 ~Class();
29};
30
31int main()
32{
33 test_rank<void, 0>();
34 test_rank<int&, 0>();
35 test_rank<Class, 0>();
36 test_rank<int*, 0>();
37 test_rank<const int*, 0>();
38 test_rank<int, 0>();
39 test_rank<double, 0>();
40 test_rank<bool, 0>();
41 test_rank<unsigned, 0>();
42
43 test_rank<char[3], 1>();
44 test_rank<char[][3], 2>();
45 test_rank<char[][4][3], 3>();
46}