This patch fixes a bug where regex_iterator doesn't indicate when it's restarting in the middle of a string. This bug causes /^a/ to match in the middle of the string "aaaaaaa", during iteration.
My patch uses `__no_update_pos` to communicate when `__at_first` is false.
Here is the test case:
```
#include <regex>
#include <cassert>
int main()
{
// Iterating over /^a/ should yield one instance at the beginning
// of the text.
const char *text = "aaa\naa";
std::regex re{"^a"};
std::cregex_iterator it{text, text+6, re};
std::cregex_iterator end{};
assert(it->str() == "a");
assert(it->position(0) == 0);
assert(it->length(0) == 1);
++it;
assert(it == end);
}
```
regex_iter.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
