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_optional    201606L [C++17]
20                           202110L [C++2b]
21 */
22 
23 #include <optional>
24 #include "test_macros.h"
25 
26 #if TEST_STD_VER < 14
27 
28 # ifdef __cpp_lib_optional
29 #   error "__cpp_lib_optional should not be defined before c++17"
30 # endif
31 
32 #elif TEST_STD_VER == 14
33 
34 # ifdef __cpp_lib_optional
35 #   error "__cpp_lib_optional should not be defined before c++17"
36 # endif
37 
38 #elif TEST_STD_VER == 17
39 
40 # ifndef __cpp_lib_optional
41 #   error "__cpp_lib_optional should be defined in c++17"
42 # endif
43 # if __cpp_lib_optional != 201606L
44 #   error "__cpp_lib_optional should have the value 201606L in c++17"
45 # endif
46 
47 #elif TEST_STD_VER == 20
48 
49 # ifndef __cpp_lib_optional
50 #   error "__cpp_lib_optional should be defined in c++20"
51 # endif
52 # if __cpp_lib_optional != 201606L
53 #   error "__cpp_lib_optional should have the value 201606L in c++20"
54 # endif
55 
56 #elif TEST_STD_VER > 20
57 
58 # ifndef __cpp_lib_optional
59 #   error "__cpp_lib_optional should be defined in c++2b"
60 # endif
61 # if __cpp_lib_optional != 202110L
62 #   error "__cpp_lib_optional should have the value 202110L in c++2b"
63 # endif
64 
65 #endif // TEST_STD_VER > 20
66 
67