constants.pass.cpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // <regex>
  9. // template <class charT, class traits = regex_traits<charT>>
  10. // class basic_regex
  11. // {
  12. // public:
  13. // // constants:
  14. // static constexpr regex_constants::syntax_option_type icase = regex_constants::icase;
  15. // static constexpr regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
  16. // static constexpr regex_constants::syntax_option_type optimize = regex_constants::optimize;
  17. // static constexpr regex_constants::syntax_option_type collate = regex_constants::collate;
  18. // static constexpr regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
  19. // static constexpr regex_constants::syntax_option_type basic = regex_constants::basic;
  20. // static constexpr regex_constants::syntax_option_type extended = regex_constants::extended;
  21. // static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
  22. // static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
  23. // static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
  24. #include <regex>
  25. #include <type_traits>
  26. #include "test_macros.h"
  27. template <class T>
  28. void where(const T &) {}
  29. template <class CharT>
  30. void
  31. test()
  32. {
  33. typedef std::basic_regex<CharT> BR;
  34. static_assert((BR::icase == std::regex_constants::icase), "");
  35. static_assert((BR::nosubs == std::regex_constants::nosubs), "");
  36. static_assert((BR::optimize == std::regex_constants::optimize), "");
  37. static_assert((BR::collate == std::regex_constants::collate), "");
  38. static_assert((BR::ECMAScript == std::regex_constants::ECMAScript), "");
  39. static_assert((BR::basic == std::regex_constants::basic), "");
  40. static_assert((BR::extended == std::regex_constants::extended), "");
  41. static_assert((BR::awk == std::regex_constants::awk), "");
  42. static_assert((BR::grep == std::regex_constants::grep), "");
  43. static_assert((BR::egrep == std::regex_constants::egrep), "");
  44. where(BR::icase);
  45. where(BR::nosubs);
  46. where(BR::optimize);
  47. where(BR::collate);
  48. where(BR::ECMAScript);
  49. where(BR::basic);
  50. where(BR::extended);
  51. where(BR::awk);
  52. where(BR::grep);
  53. where(BR::egrep);
  54. }
  55. int main(int, char**)
  56. {
  57. test<char>();
  58. test<wchar_t>();
  59. return 0;
  60. }