assign.il.pass.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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. // UNSUPPORTED: c++98, c++03
  9. // <regex>
  10. // template <class charT, class traits = regex_traits<charT>> class basic_regex;
  11. // basic_regex&
  12. // assign(initializer_list<charT> il,
  13. // flag_type f = regex_constants::ECMAScript);
  14. #include <regex>
  15. #include <cassert>
  16. #include "test_macros.h"
  17. int main(int, char**)
  18. {
  19. std::regex r2;
  20. r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'});
  21. assert(r2.flags() == std::regex::ECMAScript);
  22. assert(r2.mark_count() == 2);
  23. r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex::extended);
  24. assert(r2.flags() == std::regex::extended);
  25. assert(r2.mark_count() == 2);
  26. return 0;
  27. }