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

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