xref: /minix3/external/bsd/libc++/dist/libcxx/test/utilities/meta/meta.unary.prop.query/extent.pass.cpp (revision 4684ddb6aab0b36791c8099bc705d6140b3d05d0)
1*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
2*4684ddb6SLionel Sambuc //
3*4684ddb6SLionel Sambuc //                     The LLVM Compiler Infrastructure
4*4684ddb6SLionel Sambuc //
5*4684ddb6SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
6*4684ddb6SLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
7*4684ddb6SLionel Sambuc //
8*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
9*4684ddb6SLionel Sambuc 
10*4684ddb6SLionel Sambuc // type_traits
11*4684ddb6SLionel Sambuc 
12*4684ddb6SLionel Sambuc // extent
13*4684ddb6SLionel Sambuc 
14*4684ddb6SLionel Sambuc #include <type_traits>
15*4684ddb6SLionel Sambuc 
16*4684ddb6SLionel Sambuc template <class T, unsigned A>
test_extent()17*4684ddb6SLionel Sambuc void test_extent()
18*4684ddb6SLionel Sambuc {
19*4684ddb6SLionel Sambuc     static_assert((std::extent<T>::value == A), "");
20*4684ddb6SLionel Sambuc     static_assert((std::extent<const T>::value == A), "");
21*4684ddb6SLionel Sambuc     static_assert((std::extent<volatile T>::value == A), "");
22*4684ddb6SLionel Sambuc     static_assert((std::extent<const volatile T>::value == A), "");
23*4684ddb6SLionel Sambuc }
24*4684ddb6SLionel Sambuc 
25*4684ddb6SLionel Sambuc template <class T, unsigned A>
test_extent1()26*4684ddb6SLionel Sambuc void test_extent1()
27*4684ddb6SLionel Sambuc {
28*4684ddb6SLionel Sambuc     static_assert((std::extent<T, 1>::value == A), "");
29*4684ddb6SLionel Sambuc     static_assert((std::extent<const T, 1>::value == A), "");
30*4684ddb6SLionel Sambuc     static_assert((std::extent<volatile T, 1>::value == A), "");
31*4684ddb6SLionel Sambuc     static_assert((std::extent<const volatile T, 1>::value == A), "");
32*4684ddb6SLionel Sambuc }
33*4684ddb6SLionel Sambuc 
34*4684ddb6SLionel Sambuc class Class
35*4684ddb6SLionel Sambuc {
36*4684ddb6SLionel Sambuc public:
37*4684ddb6SLionel Sambuc     ~Class();
38*4684ddb6SLionel Sambuc };
39*4684ddb6SLionel Sambuc 
main()40*4684ddb6SLionel Sambuc int main()
41*4684ddb6SLionel Sambuc {
42*4684ddb6SLionel Sambuc     test_extent<void, 0>();
43*4684ddb6SLionel Sambuc     test_extent<int&, 0>();
44*4684ddb6SLionel Sambuc     test_extent<Class, 0>();
45*4684ddb6SLionel Sambuc     test_extent<int*, 0>();
46*4684ddb6SLionel Sambuc     test_extent<const int*, 0>();
47*4684ddb6SLionel Sambuc     test_extent<int, 0>();
48*4684ddb6SLionel Sambuc     test_extent<double, 0>();
49*4684ddb6SLionel Sambuc     test_extent<bool, 0>();
50*4684ddb6SLionel Sambuc     test_extent<unsigned, 0>();
51*4684ddb6SLionel Sambuc 
52*4684ddb6SLionel Sambuc     test_extent<int[2], 2>();
53*4684ddb6SLionel Sambuc     test_extent<int[2][4], 2>();
54*4684ddb6SLionel Sambuc     test_extent<int[][4], 0>();
55*4684ddb6SLionel Sambuc 
56*4684ddb6SLionel Sambuc     test_extent1<int, 0>();
57*4684ddb6SLionel Sambuc     test_extent1<int[2], 0>();
58*4684ddb6SLionel Sambuc     test_extent1<int[2][4], 4>();
59*4684ddb6SLionel Sambuc     test_extent1<int[][4], 4>();
60*4684ddb6SLionel Sambuc }
61