This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Regex_iterator causes infinite loop
- From: Stefan Schweter <stefan at schweter dot it>
- To: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 3 Sep 2013 22:57:54 +0200
- Subject: Regex_iterator causes infinite loop
- Authentication-results: sourceware.org; auth=none
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