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// UNSUPPORTED: c++03, c++11, c++14, c++17
9
10// type_traits
11
12// is_bounded_array<T>
13// T is an array type of known bound ([dcl.array])
14
15#include <type_traits>
16
17#include "test_macros.h"
18
19template <class T, bool B>
20void test_array_imp()
21{
22 static_assert( B == std::is_bounded_array<T>::value, "" );
23 static_assert( B == std::is_bounded_array_v<T>, "" );
24}
25
26template <class T, bool B>
27void test_array()
28{
29 test_array_imp<T, B>();
30 test_array_imp<const T, B>();
31 test_array_imp<volatile T, B>();
32 test_array_imp<const volatile T, B>();
33}
34
35class incomplete_type;
36
37class Empty {};
38union Union {};
39
40class Abstract
41{
42 virtual ~Abstract() = 0;
43};
44
45enum Enum {zero, one};
46typedef void (*FunctionPtr)();
47
48int main(int, char**)
49{
50 // Non-array types
51 test_array<void, false>();
52 test_array<std::nullptr_t, false>();
53 test_array<int, false>();
54 test_array<double, false>();
55 test_array<void *, false>();
56 test_array<int &, false>();
57 test_array<int &&, false>();
58 test_array<Empty, false>();
59 test_array<Union, false>();
60 test_array<Abstract, false>();
61 test_array<Enum, false>();
62 test_array<FunctionPtr, false>();
63
64 // Array types
65 test_array<char[3], true>();
66 test_array<int[0], false>();
67 test_array<char[], false>();
68 test_array<incomplete_type[], false>();
69
70 return 0;
71}
72

source code of libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/is_bounded_array.pass.cpp