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_expected
24# error "__cpp_lib_expected should not be defined before c++23"
25# endif
26
27# ifdef __cpp_lib_freestanding_expected
28# error "__cpp_lib_freestanding_expected should not be defined before c++26"
29# endif
30
31#elif TEST_STD_VER == 14
32
33# ifdef __cpp_lib_expected
34# error "__cpp_lib_expected should not be defined before c++23"
35# endif
36
37# ifdef __cpp_lib_freestanding_expected
38# error "__cpp_lib_freestanding_expected should not be defined before c++26"
39# endif
40
41#elif TEST_STD_VER == 17
42
43# ifdef __cpp_lib_expected
44# error "__cpp_lib_expected should not be defined before c++23"
45# endif
46
47# ifdef __cpp_lib_freestanding_expected
48# error "__cpp_lib_freestanding_expected should not be defined before c++26"
49# endif
50
51#elif TEST_STD_VER == 20
52
53# ifdef __cpp_lib_expected
54# error "__cpp_lib_expected should not be defined before c++23"
55# endif
56
57# ifdef __cpp_lib_freestanding_expected
58# error "__cpp_lib_freestanding_expected should not be defined before c++26"
59# endif
60
61#elif TEST_STD_VER == 23
62
63# ifndef __cpp_lib_expected
64# error "__cpp_lib_expected should be defined in c++23"
65# endif
66# if __cpp_lib_expected != 202211L
67# error "__cpp_lib_expected should have the value 202211L in c++23"
68# endif
69
70# ifdef __cpp_lib_freestanding_expected
71# error "__cpp_lib_freestanding_expected should not be defined before c++26"
72# endif
73
74#elif TEST_STD_VER > 23
75
76# ifndef __cpp_lib_expected
77# error "__cpp_lib_expected should be defined in c++26"
78# endif
79# if __cpp_lib_expected != 202211L
80# error "__cpp_lib_expected should have the value 202211L in c++26"
81# endif
82
83# if !defined(_LIBCPP_VERSION)
84# ifndef __cpp_lib_freestanding_expected
85# error "__cpp_lib_freestanding_expected should be defined in c++26"
86# endif
87# if __cpp_lib_freestanding_expected != 202311L
88# error "__cpp_lib_freestanding_expected should have the value 202311L in c++26"
89# endif
90# else
91# ifdef __cpp_lib_freestanding_expected
92# error "__cpp_lib_freestanding_expected should not be defined because it is unimplemented in libc++!"
93# endif
94# endif
95
96#endif // TEST_STD_VER > 23
97
98// clang-format on
99
100

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