Regex_iterator causes infinite loop
Stefan Schweter
stefan@schweter.it
Tue Sep 3 20:58:00 GMT 2013
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
More information about the Libstdc++
mailing list