array.version.pass.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // WARNING: This test was generated by generate_feature_test_macros_tests.py and
  11. // should not be edited manually.
  12. // <array>
  13. // Test the feature test macros defined by <array>
  14. /* Constant Value
  15. __cpp_lib_array_constexpr 201603L [C++17]
  16. __cpp_lib_constexpr_misc 201811L [C++2a]
  17. __cpp_lib_nonmember_container_access 201411L [C++17]
  18. */
  19. #include <array>
  20. #include "test_macros.h"
  21. #if TEST_STD_VER < 14
  22. # ifdef __cpp_lib_array_constexpr
  23. # error "__cpp_lib_array_constexpr should not be defined before c++17"
  24. # endif
  25. # ifdef __cpp_lib_constexpr_misc
  26. # error "__cpp_lib_constexpr_misc should not be defined before c++2a"
  27. # endif
  28. # ifdef __cpp_lib_nonmember_container_access
  29. # error "__cpp_lib_nonmember_container_access should not be defined before c++17"
  30. # endif
  31. #elif TEST_STD_VER == 14
  32. # ifdef __cpp_lib_array_constexpr
  33. # error "__cpp_lib_array_constexpr should not be defined before c++17"
  34. # endif
  35. # ifdef __cpp_lib_constexpr_misc
  36. # error "__cpp_lib_constexpr_misc should not be defined before c++2a"
  37. # endif
  38. # ifdef __cpp_lib_nonmember_container_access
  39. # error "__cpp_lib_nonmember_container_access should not be defined before c++17"
  40. # endif
  41. #elif TEST_STD_VER == 17
  42. # ifndef __cpp_lib_array_constexpr
  43. # error "__cpp_lib_array_constexpr should be defined in c++17"
  44. # endif
  45. # if __cpp_lib_array_constexpr != 201603L
  46. # error "__cpp_lib_array_constexpr should have the value 201603L in c++17"
  47. # endif
  48. # ifdef __cpp_lib_constexpr_misc
  49. # error "__cpp_lib_constexpr_misc should not be defined before c++2a"
  50. # endif
  51. # ifndef __cpp_lib_nonmember_container_access
  52. # error "__cpp_lib_nonmember_container_access should be defined in c++17"
  53. # endif
  54. # if __cpp_lib_nonmember_container_access != 201411L
  55. # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
  56. # endif
  57. #elif TEST_STD_VER > 17
  58. # ifndef __cpp_lib_array_constexpr
  59. # error "__cpp_lib_array_constexpr should be defined in c++2a"
  60. # endif
  61. # if __cpp_lib_array_constexpr != 201603L
  62. # error "__cpp_lib_array_constexpr should have the value 201603L in c++2a"
  63. # endif
  64. # if !defined(_LIBCPP_VERSION)
  65. # ifndef __cpp_lib_constexpr_misc
  66. # error "__cpp_lib_constexpr_misc should be defined in c++2a"
  67. # endif
  68. # if __cpp_lib_constexpr_misc != 201811L
  69. # error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
  70. # endif
  71. # else // _LIBCPP_VERSION
  72. # ifdef __cpp_lib_constexpr_misc
  73. # error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
  74. # endif
  75. # endif
  76. # ifndef __cpp_lib_nonmember_container_access
  77. # error "__cpp_lib_nonmember_container_access should be defined in c++2a"
  78. # endif
  79. # if __cpp_lib_nonmember_container_access != 201411L
  80. # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
  81. # endif
  82. #endif // TEST_STD_VER > 17
  83. int main() {}