This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Regex_iterator causes infinite loop


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]