On Sat, Aug 24, 2013 at 1:51 AM, Stefan Schweter wrote: > Am Fri, 23 Aug 2013 17:17:41 +0800 > schrieb Tim Shen : > >> Inspired by this mail: >> http://gcc.gnu.org/ml/libstdc++/2013-08/msg00131.html >> >> Thanks! >> >> > > Hi Tim, > > I applied the patch + compiled everything - it's working now! Thanks! > > But... I found a problem with .imbue(): > > int main() > { > std::setlocale(LC_ALL, ""); > > std::wstring str2 = L"öäü"; > std::wregex re2; > re2.imbue(std::locale("")); > re2.assign(L"([[:lower:]]+)"); > std::wsmatch m2; > > std::wsregex_token_iterator end {}; > > for (std::wsregex_token_iterator p{str2.begin(), str2.end(), > re2, {1}}; p != end; ++p) { std::wcout << *p << std::endl; > } > > return 0; > } > > Works fine! But when there's no imbue() call, a Segmentation > fault occurs. > > int main() > { > std::setlocale(LC_ALL, ""); > > std::wstring str2 = L"öäü"; > std::wregex re2; > //re2.imbue(std::locale("")); > re2.assign(L"([[:lower:]]+)"); > std::wsmatch m2; > > std::wsregex_token_iterator end {}; > > for (std::wsregex_token_iterator p{str2.begin(), str2.end(), > re2, {1}}; p != end; ++p) { std::wcout << *p << std::endl; > } > > return 0; > } > > May be it's better to throw an exception here? Thanks in advance, > > Stefan Fixed. It's not fully tested. I just run the 28_regex testcases. I'll do a full test before committing. Thanks again! -- Tim Shen