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

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