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

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