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// clang-format off
13
14// <new>
15
16// Test the feature test macros defined by <new>
17
18/* Constant Value
19 __cpp_lib_destroying_delete 201806L [C++20]
20 __cpp_lib_hardware_interference_size 201703L [C++17]
21 __cpp_lib_launder 201606L [C++17]
22*/
23
24#include <new>
25#include "test_macros.h"
26
27#if TEST_STD_VER < 14
28
29# ifdef __cpp_lib_destroying_delete
30# error "__cpp_lib_destroying_delete should not be defined before c++20"
31# endif
32
33# ifdef __cpp_lib_hardware_interference_size
34# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
35# endif
36
37# ifdef __cpp_lib_launder
38# error "__cpp_lib_launder should not be defined before c++17"
39# endif
40
41#elif TEST_STD_VER == 14
42
43# ifdef __cpp_lib_destroying_delete
44# error "__cpp_lib_destroying_delete should not be defined before c++20"
45# endif
46
47# ifdef __cpp_lib_hardware_interference_size
48# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
49# endif
50
51# ifdef __cpp_lib_launder
52# error "__cpp_lib_launder should not be defined before c++17"
53# endif
54
55#elif TEST_STD_VER == 17
56
57# ifdef __cpp_lib_destroying_delete
58# error "__cpp_lib_destroying_delete should not be defined before c++20"
59# endif
60
61# if !defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))
62# ifndef __cpp_lib_hardware_interference_size
63# error "__cpp_lib_hardware_interference_size should be defined in c++17"
64# endif
65# if __cpp_lib_hardware_interference_size != 201703L
66# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17"
67# endif
68# else
69# ifdef __cpp_lib_hardware_interference_size
70# error "__cpp_lib_hardware_interference_size should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))' is not met!"
71# endif
72# endif
73
74# ifndef __cpp_lib_launder
75# error "__cpp_lib_launder should be defined in c++17"
76# endif
77# if __cpp_lib_launder != 201606L
78# error "__cpp_lib_launder should have the value 201606L in c++17"
79# endif
80
81#elif TEST_STD_VER == 20
82
83# if TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
84# ifndef __cpp_lib_destroying_delete
85# error "__cpp_lib_destroying_delete should be defined in c++20"
86# endif
87# if __cpp_lib_destroying_delete != 201806L
88# error "__cpp_lib_destroying_delete should have the value 201806L in c++20"
89# endif
90# else
91# ifdef __cpp_lib_destroying_delete
92# error "__cpp_lib_destroying_delete should not be defined when the requirement 'TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L' is not met!"
93# endif
94# endif
95
96# if !defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))
97# ifndef __cpp_lib_hardware_interference_size
98# error "__cpp_lib_hardware_interference_size should be defined in c++20"
99# endif
100# if __cpp_lib_hardware_interference_size != 201703L
101# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++20"
102# endif
103# else
104# ifdef __cpp_lib_hardware_interference_size
105# error "__cpp_lib_hardware_interference_size should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))' is not met!"
106# endif
107# endif
108
109# ifndef __cpp_lib_launder
110# error "__cpp_lib_launder should be defined in c++20"
111# endif
112# if __cpp_lib_launder != 201606L
113# error "__cpp_lib_launder should have the value 201606L in c++20"
114# endif
115
116#elif TEST_STD_VER == 23
117
118# if TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
119# ifndef __cpp_lib_destroying_delete
120# error "__cpp_lib_destroying_delete should be defined in c++23"
121# endif
122# if __cpp_lib_destroying_delete != 201806L
123# error "__cpp_lib_destroying_delete should have the value 201806L in c++23"
124# endif
125# else
126# ifdef __cpp_lib_destroying_delete
127# error "__cpp_lib_destroying_delete should not be defined when the requirement 'TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L' is not met!"
128# endif
129# endif
130
131# if !defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))
132# ifndef __cpp_lib_hardware_interference_size
133# error "__cpp_lib_hardware_interference_size should be defined in c++23"
134# endif
135# if __cpp_lib_hardware_interference_size != 201703L
136# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++23"
137# endif
138# else
139# ifdef __cpp_lib_hardware_interference_size
140# error "__cpp_lib_hardware_interference_size should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))' is not met!"
141# endif
142# endif
143
144# ifndef __cpp_lib_launder
145# error "__cpp_lib_launder should be defined in c++23"
146# endif
147# if __cpp_lib_launder != 201606L
148# error "__cpp_lib_launder should have the value 201606L in c++23"
149# endif
150
151#elif TEST_STD_VER > 23
152
153# if TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
154# ifndef __cpp_lib_destroying_delete
155# error "__cpp_lib_destroying_delete should be defined in c++26"
156# endif
157# if __cpp_lib_destroying_delete != 201806L
158# error "__cpp_lib_destroying_delete should have the value 201806L in c++26"
159# endif
160# else
161# ifdef __cpp_lib_destroying_delete
162# error "__cpp_lib_destroying_delete should not be defined when the requirement 'TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L' is not met!"
163# endif
164# endif
165
166# if !defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))
167# ifndef __cpp_lib_hardware_interference_size
168# error "__cpp_lib_hardware_interference_size should be defined in c++26"
169# endif
170# if __cpp_lib_hardware_interference_size != 201703L
171# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++26"
172# endif
173# else
174# ifdef __cpp_lib_hardware_interference_size
175# error "__cpp_lib_hardware_interference_size should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))' is not met!"
176# endif
177# endif
178
179# ifndef __cpp_lib_launder
180# error "__cpp_lib_launder should be defined in c++26"
181# endif
182# if __cpp_lib_launder != 201606L
183# error "__cpp_lib_launder should have the value 201606L in c++26"
184# endif
185
186#endif // TEST_STD_VER > 23
187
188

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