Describe the bug
Since MSVC Build Tools 14.50, a lookahead assertion inside a repeated pattern results in a regex_error(error_stack).
Test case
#include <iostream>
#include <regex>
#include <string>
using namespace std;
int main() {
try {
regex re("(?:(?=ab))*");
(void) regex_match("xyz", re);
cout << "no exception\n";
} catch (const regex_error& ex) {
cout << "regex_error with code " << ex.code() << "\n";
}
return 0;
}
This prints "regex_error with code 12".
Expected behavior
Should print "no exception".
STL version
MSVC Build Tools 18.50 up to current head.
Additional context
I introduced this bug in #5456. But I expect that its practical impact is very limited: It is very difficult to reason about a repeated pattern that contains a lookahead assertion.