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// <memory_resource>
13
14// Test the feature test macros defined by <memory_resource>
15
16// clang-format off
17
18#include <memory_resource>
19#include "test_macros.h"
20
21#if TEST_STD_VER < 14
22
23# ifdef __cpp_lib_memory_resource
24# error "__cpp_lib_memory_resource should not be defined before c++17"
25# endif
26
27# ifdef __cpp_lib_polymorphic_allocator
28# error "__cpp_lib_polymorphic_allocator should not be defined before c++20"
29# endif
30
31#elif TEST_STD_VER == 14
32
33# ifdef __cpp_lib_memory_resource
34# error "__cpp_lib_memory_resource should not be defined before c++17"
35# endif
36
37# ifdef __cpp_lib_polymorphic_allocator
38# error "__cpp_lib_polymorphic_allocator should not be defined before c++20"
39# endif
40
41#elif TEST_STD_VER == 17
42
43# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
44# ifndef __cpp_lib_memory_resource
45# error "__cpp_lib_memory_resource should be defined in c++17"
46# endif
47# if __cpp_lib_memory_resource != 201603L
48# error "__cpp_lib_memory_resource should have the value 201603L in c++17"
49# endif
50# else
51# ifdef __cpp_lib_memory_resource
52# error "__cpp_lib_memory_resource should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
53# endif
54# endif
55
56# ifdef __cpp_lib_polymorphic_allocator
57# error "__cpp_lib_polymorphic_allocator should not be defined before c++20"
58# endif
59
60#elif TEST_STD_VER == 20
61
62# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
63# ifndef __cpp_lib_memory_resource
64# error "__cpp_lib_memory_resource should be defined in c++20"
65# endif
66# if __cpp_lib_memory_resource != 201603L
67# error "__cpp_lib_memory_resource should have the value 201603L in c++20"
68# endif
69# else
70# ifdef __cpp_lib_memory_resource
71# error "__cpp_lib_memory_resource should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
72# endif
73# endif
74
75# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
76# ifndef __cpp_lib_polymorphic_allocator
77# error "__cpp_lib_polymorphic_allocator should be defined in c++20"
78# endif
79# if __cpp_lib_polymorphic_allocator != 201902L
80# error "__cpp_lib_polymorphic_allocator should have the value 201902L in c++20"
81# endif
82# else
83# ifdef __cpp_lib_polymorphic_allocator
84# error "__cpp_lib_polymorphic_allocator should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
85# endif
86# endif
87
88#elif TEST_STD_VER == 23
89
90# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
91# ifndef __cpp_lib_memory_resource
92# error "__cpp_lib_memory_resource should be defined in c++23"
93# endif
94# if __cpp_lib_memory_resource != 201603L
95# error "__cpp_lib_memory_resource should have the value 201603L in c++23"
96# endif
97# else
98# ifdef __cpp_lib_memory_resource
99# error "__cpp_lib_memory_resource should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
100# endif
101# endif
102
103# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
104# ifndef __cpp_lib_polymorphic_allocator
105# error "__cpp_lib_polymorphic_allocator should be defined in c++23"
106# endif
107# if __cpp_lib_polymorphic_allocator != 201902L
108# error "__cpp_lib_polymorphic_allocator should have the value 201902L in c++23"
109# endif
110# else
111# ifdef __cpp_lib_polymorphic_allocator
112# error "__cpp_lib_polymorphic_allocator should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
113# endif
114# endif
115
116#elif TEST_STD_VER > 23
117
118# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
119# ifndef __cpp_lib_memory_resource
120# error "__cpp_lib_memory_resource should be defined in c++26"
121# endif
122# if __cpp_lib_memory_resource != 201603L
123# error "__cpp_lib_memory_resource should have the value 201603L in c++26"
124# endif
125# else
126# ifdef __cpp_lib_memory_resource
127# error "__cpp_lib_memory_resource should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
128# endif
129# endif
130
131# if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR
132# ifndef __cpp_lib_polymorphic_allocator
133# error "__cpp_lib_polymorphic_allocator should be defined in c++26"
134# endif
135# if __cpp_lib_polymorphic_allocator != 201902L
136# error "__cpp_lib_polymorphic_allocator should have the value 201902L in c++26"
137# endif
138# else
139# ifdef __cpp_lib_polymorphic_allocator
140# error "__cpp_lib_polymorphic_allocator should not be defined when the requirement '!defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_PMR' is not met!"
141# endif
142# endif
143
144#endif // TEST_STD_VER > 23
145
146// clang-format on
147
148

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