LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 33681 - Iterating using regex_iterator never ends
Summary: Iterating using regex_iterator never ends
Status: RESOLVED FIXED
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: 3.9
Hardware: PC Linux
: P normal
Assignee: Marshall Clow (home)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-03 11:15 PDT by Karen Arutyunov
Modified: 2017-07-05 09:37 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Arutyunov 2017-07-03 11:15:18 PDT
While using regex_iterator template in our build2 toolchain project we have discovered that for some regular expressions the end iterator can never be reached.

The issue can be reproduced with the following code:

std::string s ("foo");
std::regex re (".*");

using it = std::regex_iterator<std::string::const_iterator>;

for (it i (s.begin (), s.end (), re), e; i != e; ++i) ; // Hangs.
Comment 1 Marshall Clow (home) 2017-07-04 08:44:06 PDT
If you change your regex to '.+' (match at least one character), it works fine.
Comment 2 Karen Arutyunov 2017-07-04 09:05:44 PDT
You right. Unfortunately, in our case regexes come from the end user, so we unable to amend them.
Comment 3 Marshall Clow (home) 2017-07-05 09:37:54 PDT
Fixed in revision 307171