This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Regex_iterator causes infinite loop
- From: Tim Shen <timshen91 at gmail dot com>
- To: Stefan Schweter <stefan at schweter dot it>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 3 Sep 2013 22:27:25 -0400
- Subject: Re: Regex_iterator causes infinite loop
- Authentication-results: sourceware.org; auth=none
- References: <20130903225754 dot 4bee7d95 at arch-64-politeia>
On Tue, Sep 3, 2013 at 4:57 PM, Stefan Schweter <stefan@schweter.it> wrote:
> Hi,
>
> I tested the following code with gcc 4.9 (trunk: 20130903) + the
> "Rewrite _stateSeq patch" applied:
>
> #include <iostream>
> #include <regex>
>
> int main()
> {
> std::setlocale(LC_ALL, "");
>
> std::wstring str2 = L"ä\u2009Ä\u2009ö\u2009Ö\u2009ü\u2009Ü";
>
> std::wregex re2;
> re2.imbue(std::locale(""));
>
> re2.assign(L"([[:lower:]]{0,1}[[:space:]]{0,1}[[:upper:]]{0,1})");
>
> for (std::wsregex_iterator p(str2.begin(), str2.end(), re2);
> p != std::wsregex_iterator{}; ++p) {
> std::wcout << (*p)[1] << std::endl;
> }
>
> return 0;
> }
>
> Unfortunately, this causes an infinite loop. The last
> "{0,1}" should be the problem in that context.
>
> Thanks,
>
> Stefan
This is because regex_constants::match_not_null,
regex_constants::match_continuous and
regex_constants::match_prev_avail are not implemented yet.
It shall be fixed after completing assertion. I'll post a testcase later.
--
Tim Shen