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

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