<div dir="ltr">This patch addresses <a href="http://llvm.org/bugs/show_bug.cgi?id=11118" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=11118</a><br><div class="gmail_quote"><div dir="ltr"><div><br></div><div>A bug in __lookahead::exec causes /(?=^)b/ to match "ab". When `__lookahead::__exec` makes a recursive call to `__exp_.__match_at_start_ecma`, it passes true for the value of `__at_first`. This causes a beginning-of-line anchor (^) inside a lookahead assertion to match anywhere in the text.</div>

<div><br></div><div>Here is a test case (before the patch, both asserts fail).</div><div><br></div><div>```</div><div>#include <regex></div><div>#include <cassert></div><div><br></div><div>int main() </div><div>

{</div><div>    assert(!std::regex_search("ab", std::regex("(?=^)b")));</div><div>    assert(!std::regex_search("ab", std::regex("a(?=^)b")));</div><div>}</div><div>```</div><div><br>

</div><div><br></div></div>
</div><br></div>