constants.pass.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // <regex>
  10. // template <class charT, class traits = regex_traits<charT>>
  11. // class basic_regex
  12. // {
  13. // public:
  14. // // constants:
  15. // static constexpr regex_constants::syntax_option_type icase = regex_constants::icase;
  16. // static constexpr regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
  17. // static constexpr regex_constants::syntax_option_type optimize = regex_constants::optimize;
  18. // static constexpr regex_constants::syntax_option_type collate = regex_constants::collate;
  19. // static constexpr regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
  20. // static constexpr regex_constants::syntax_option_type basic = regex_constants::basic;
  21. // static constexpr regex_constants::syntax_option_type extended = regex_constants::extended;
  22. // static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
  23. // static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
  24. // static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
  25. #include <regex>
  26. #include <type_traits>
  27. template <class _Tp>
  28. void where(const _Tp &) {}
  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()
  56. {
  57. test<char>();
  58. test<wchar_t>();
  59. }