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 // <optional>
15 
16 // Test the feature test macros defined by <optional>
17 
18 /*  Constant                      Value
19     __cpp_lib_monadic_optional    202110L [C++2b]
20     __cpp_lib_optional            201606L [C++17]
21 */
22 
23 #include <optional>
24 #include "test_macros.h"
25 
26 #if TEST_STD_VER < 14
27 
28 # ifdef __cpp_lib_monadic_optional
29 #   error "__cpp_lib_monadic_optional should not be defined before c++2b"
30 # endif
31 
32 # ifdef __cpp_lib_optional
33 #   error "__cpp_lib_optional should not be defined before c++17"
34 # endif
35 
36 #elif TEST_STD_VER == 14
37 
38 # ifdef __cpp_lib_monadic_optional
39 #   error "__cpp_lib_monadic_optional should not be defined before c++2b"
40 # endif
41 
42 # ifdef __cpp_lib_optional
43 #   error "__cpp_lib_optional should not be defined before c++17"
44 # endif
45 
46 #elif TEST_STD_VER == 17
47 
48 # ifdef __cpp_lib_monadic_optional
49 #   error "__cpp_lib_monadic_optional should not be defined before c++2b"
50 # endif
51 
52 # ifndef __cpp_lib_optional
53 #   error "__cpp_lib_optional should be defined in c++17"
54 # endif
55 # if __cpp_lib_optional != 201606L
56 #   error "__cpp_lib_optional should have the value 201606L in c++17"
57 # endif
58 
59 #elif TEST_STD_VER == 20
60 
61 # ifdef __cpp_lib_monadic_optional
62 #   error "__cpp_lib_monadic_optional should not be defined before c++2b"
63 # endif
64 
65 # ifndef __cpp_lib_optional
66 #   error "__cpp_lib_optional should be defined in c++20"
67 # endif
68 # if __cpp_lib_optional != 201606L
69 #   error "__cpp_lib_optional should have the value 201606L in c++20"
70 # endif
71 
72 #elif TEST_STD_VER > 20
73 
74 # ifndef __cpp_lib_monadic_optional
75 #   error "__cpp_lib_monadic_optional should be defined in c++2b"
76 # endif
77 # if __cpp_lib_monadic_optional != 202110L
78 #   error "__cpp_lib_monadic_optional should have the value 202110L in c++2b"
79 # endif
80 
81 # ifndef __cpp_lib_optional
82 #   error "__cpp_lib_optional should be defined in c++2b"
83 # endif
84 # if __cpp_lib_optional != 201606L
85 #   error "__cpp_lib_optional should have the value 201606L in c++2b"
86 # endif
87 
88 #endif // TEST_STD_VER > 20
89 
90