[Clang][ASTMatcher] Add a matcher for the name of a DependentScopeDeclRefExpr (#121656)
[llvm-project.git] / libcxx / test / std / utilities / meta / meta.unary.prop.query / extent.pass.cpp
blob927ce1373cc063ff9870fdd685fe5b2cf2d95f17
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 //===----------------------------------------------------------------------===//
9 // type_traits
11 // extent
13 #include <type_traits>
15 #include "test_macros.h"
17 template <class T, unsigned A>
18 void test_extent()
20 static_assert((std::extent<T>::value == A), "");
21 static_assert((std::extent<const T>::value == A), "");
22 static_assert((std::extent<volatile T>::value == A), "");
23 static_assert((std::extent<const volatile T>::value == A), "");
24 #if TEST_STD_VER > 14
25 static_assert((std::extent_v<T> == A), "");
26 static_assert((std::extent_v<const T> == A), "");
27 static_assert((std::extent_v<volatile T> == A), "");
28 static_assert((std::extent_v<const volatile T> == A), "");
29 #endif
32 template <class T, unsigned A>
33 void test_extent1()
35 static_assert((std::extent<T, 1>::value == A), "");
36 static_assert((std::extent<const T, 1>::value == A), "");
37 static_assert((std::extent<volatile T, 1>::value == A), "");
38 static_assert((std::extent<const volatile T, 1>::value == A), "");
39 #if TEST_STD_VER > 14
40 static_assert((std::extent_v<T, 1> == A), "");
41 static_assert((std::extent_v<const T, 1> == A), "");
42 static_assert((std::extent_v<volatile T, 1> == A), "");
43 static_assert((std::extent_v<const volatile T, 1> == A), "");
44 #endif
47 class Class
49 public:
50 ~Class();
53 int main(int, char**)
55 test_extent<void, 0>();
56 test_extent<int&, 0>();
57 test_extent<Class, 0>();
58 test_extent<int*, 0>();
59 test_extent<const int*, 0>();
60 test_extent<int, 0>();
61 test_extent<double, 0>();
62 test_extent<bool, 0>();
63 test_extent<unsigned, 0>();
65 test_extent<int[2], 2>();
66 test_extent<int[2][4], 2>();
67 test_extent<int[][4], 0>();
69 test_extent1<int, 0>();
70 test_extent1<int[2], 0>();
71 test_extent1<int[2][4], 4>();
72 test_extent1<int[][4], 4>();
74 return 0;