Marshall Clow | dd426c2 | 2019-01-31 18:54:26 +0000 | [diff] [blame] | 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 | |
| 9 | // <regex> |
Louis Dionne | 8c61114 | 2020-04-17 10:29:15 -0400 | [diff] [blame] | 10 | // UNSUPPORTED: no-exceptions |
Marshall Clow | dd426c2 | 2019-01-31 18:54:26 +0000 | [diff] [blame] | 11 | |
| 12 | // template <class OutputIterator, class BidirectionalIterator, |
| 13 | // class traits, class charT, class ST, class SA> |
| 14 | // OutputIterator |
| 15 | // regex_replace(OutputIterator out, |
| 16 | // BidirectionalIterator first, BidirectionalIterator last, |
| 17 | // const basic_regex<charT, traits>& e, |
| 18 | // const basic_string<charT, ST, SA>& fmt, |
| 19 | // regex_constants::match_flag_type flags = |
| 20 | // regex_constants::match_default); |
| 21 | |
| 22 | #include <regex> |
| 23 | #include <cassert> |
| 24 | |
| 25 | #include "test_macros.h" |
| 26 | |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 27 | int main(int, char**) |
Marshall Clow | dd426c2 | 2019-01-31 18:54:26 +0000 | [diff] [blame] | 28 | { |
| 29 | try { |
| 30 | std::regex re("a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaa"); |
| 31 | const char s[] = "aaaaaaaaaaaaaaaaaaaa"; |
| 32 | std::string r = std::regex_replace(s, re, "123-&", std::regex_constants::format_sed); |
| 33 | LIBCPP_ASSERT(false); |
| 34 | assert(r == "123-aaaaaaaaaaaaaaaaaaaa"); |
| 35 | } catch (const std::regex_error &e) { |
| 36 | assert(e.code() == std::regex_constants::error_complexity); |
| 37 | } |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 38 | return 0; |
Marshall Clow | dd426c2 | 2019-01-31 18:54:26 +0000 | [diff] [blame] | 39 | } |