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// WARNING: This test was generated by generate_feature_test_macro_components.py
10// and should not be edited manually.
11
12// <array>
13
14// Test the feature test macros defined by <array>
15
16// clang-format off
17
18#include <array>
19#include "test_macros.h"
20
21#if TEST_STD_VER < 14
22
23# ifdef __cpp_lib_array_constexpr
24# error "__cpp_lib_array_constexpr should not be defined before c++17"
25# endif
26
27# ifdef __cpp_lib_freestanding_array
28# error "__cpp_lib_freestanding_array should not be defined before c++26"
29# endif
30
31# ifdef __cpp_lib_nonmember_container_access
32# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
33# endif
34
35# ifdef __cpp_lib_to_array
36# error "__cpp_lib_to_array should not be defined before c++20"
37# endif
38
39#elif TEST_STD_VER == 14
40
41# ifdef __cpp_lib_array_constexpr
42# error "__cpp_lib_array_constexpr should not be defined before c++17"
43# endif
44
45# ifdef __cpp_lib_freestanding_array
46# error "__cpp_lib_freestanding_array should not be defined before c++26"
47# endif
48
49# ifdef __cpp_lib_nonmember_container_access
50# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
51# endif
52
53# ifdef __cpp_lib_to_array
54# error "__cpp_lib_to_array should not be defined before c++20"
55# endif
56
57#elif TEST_STD_VER == 17
58
59# ifndef __cpp_lib_array_constexpr
60# error "__cpp_lib_array_constexpr should be defined in c++17"
61# endif
62# if __cpp_lib_array_constexpr != 201603L
63# error "__cpp_lib_array_constexpr should have the value 201603L in c++17"
64# endif
65
66# ifdef __cpp_lib_freestanding_array
67# error "__cpp_lib_freestanding_array should not be defined before c++26"
68# endif
69
70# ifndef __cpp_lib_nonmember_container_access
71# error "__cpp_lib_nonmember_container_access should be defined in c++17"
72# endif
73# if __cpp_lib_nonmember_container_access != 201411L
74# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
75# endif
76
77# ifdef __cpp_lib_to_array
78# error "__cpp_lib_to_array should not be defined before c++20"
79# endif
80
81#elif TEST_STD_VER == 20
82
83# ifndef __cpp_lib_array_constexpr
84# error "__cpp_lib_array_constexpr should be defined in c++20"
85# endif
86# if __cpp_lib_array_constexpr != 201811L
87# error "__cpp_lib_array_constexpr should have the value 201811L in c++20"
88# endif
89
90# ifdef __cpp_lib_freestanding_array
91# error "__cpp_lib_freestanding_array should not be defined before c++26"
92# endif
93
94# ifndef __cpp_lib_nonmember_container_access
95# error "__cpp_lib_nonmember_container_access should be defined in c++20"
96# endif
97# if __cpp_lib_nonmember_container_access != 201411L
98# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20"
99# endif
100
101# ifndef __cpp_lib_to_array
102# error "__cpp_lib_to_array should be defined in c++20"
103# endif
104# if __cpp_lib_to_array != 201907L
105# error "__cpp_lib_to_array should have the value 201907L in c++20"
106# endif
107
108#elif TEST_STD_VER == 23
109
110# ifndef __cpp_lib_array_constexpr
111# error "__cpp_lib_array_constexpr should be defined in c++23"
112# endif
113# if __cpp_lib_array_constexpr != 201811L
114# error "__cpp_lib_array_constexpr should have the value 201811L in c++23"
115# endif
116
117# ifdef __cpp_lib_freestanding_array
118# error "__cpp_lib_freestanding_array should not be defined before c++26"
119# endif
120
121# ifndef __cpp_lib_nonmember_container_access
122# error "__cpp_lib_nonmember_container_access should be defined in c++23"
123# endif
124# if __cpp_lib_nonmember_container_access != 201411L
125# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"
126# endif
127
128# ifndef __cpp_lib_to_array
129# error "__cpp_lib_to_array should be defined in c++23"
130# endif
131# if __cpp_lib_to_array != 201907L
132# error "__cpp_lib_to_array should have the value 201907L in c++23"
133# endif
134
135#elif TEST_STD_VER > 23
136
137# ifndef __cpp_lib_array_constexpr
138# error "__cpp_lib_array_constexpr should be defined in c++26"
139# endif
140# if __cpp_lib_array_constexpr != 201811L
141# error "__cpp_lib_array_constexpr should have the value 201811L in c++26"
142# endif
143
144# if !defined(_LIBCPP_VERSION)
145# ifndef __cpp_lib_freestanding_array
146# error "__cpp_lib_freestanding_array should be defined in c++26"
147# endif
148# if __cpp_lib_freestanding_array != 202311L
149# error "__cpp_lib_freestanding_array should have the value 202311L in c++26"
150# endif
151# else
152# ifdef __cpp_lib_freestanding_array
153# error "__cpp_lib_freestanding_array should not be defined because it is unimplemented in libc++!"
154# endif
155# endif
156
157# ifndef __cpp_lib_nonmember_container_access
158# error "__cpp_lib_nonmember_container_access should be defined in c++26"
159# endif
160# if __cpp_lib_nonmember_container_access != 201411L
161# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"
162# endif
163
164# ifndef __cpp_lib_to_array
165# error "__cpp_lib_to_array should be defined in c++26"
166# endif
167# if __cpp_lib_to_array != 201907L
168# error "__cpp_lib_to_array should have the value 201907L in c++26"
169# endif
170
171#endif // TEST_STD_VER > 23
172
173// clang-format on
174
175

source code of libcxx/test/std/language.support/support.limits/support.limits.general/array.version.compile.pass.cpp