optional.version.pass.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. // <optional>
  12. // Test the feature test macros defined by <optional>
  13. /* Constant Value
  14. __cpp_lib_optional 201606L [C++17]
  15. */
  16. #include <optional>
  17. #include "test_macros.h"
  18. #if TEST_STD_VER < 14
  19. # ifdef __cpp_lib_optional
  20. # error "__cpp_lib_optional should not be defined before c++17"
  21. # endif
  22. #elif TEST_STD_VER == 14
  23. # ifdef __cpp_lib_optional
  24. # error "__cpp_lib_optional should not be defined before c++17"
  25. # endif
  26. #elif TEST_STD_VER == 17
  27. # ifndef __cpp_lib_optional
  28. # error "__cpp_lib_optional should be defined in c++17"
  29. # endif
  30. # if __cpp_lib_optional != 201606L
  31. # error "__cpp_lib_optional should have the value 201606L in c++17"
  32. # endif
  33. #elif TEST_STD_VER > 17
  34. # ifndef __cpp_lib_optional
  35. # error "__cpp_lib_optional should be defined in c++2a"
  36. # endif
  37. # if __cpp_lib_optional != 201606L
  38. # error "__cpp_lib_optional should have the value 201606L in c++2a"
  39. # endif
  40. #endif // TEST_STD_VER > 17
  41. int main(int, char**) { return 0; }