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

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