ptr.pass.cpp 904 B

123456789101112131415161718192021222324252627282930313233343536
  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>> class basic_regex;
  10. // basic_regex(const charT* p);
  11. #include <regex>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. template <class CharT>
  15. void
  16. test(const CharT* p, unsigned mc)
  17. {
  18. std::basic_regex<CharT> r(p);
  19. assert(r.flags() == std::regex_constants::ECMAScript);
  20. assert(r.mark_count() == mc);
  21. }
  22. int main(int, char**)
  23. {
  24. test("\\(a\\)", 0);
  25. test("\\(a[bc]\\)", 0);
  26. test("\\(a\\([bc]\\)\\)", 0);
  27. test("(a([bc]))", 2);
  28. return 0;
  29. }