https://bugs.llvm.org/show_bug.cgi?id=34297
Bug ID: 34297
Summary: regex constructor does not throw an exception for
invalid backreferences in basic/grep patterns
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: arthur.j.odw...@gmail.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com
#include <regex>
#include <stdio.h>
int main() {
std::regex rx("(cat)\\1", std::regex::basic);
puts("Constructed without throwing: oops!");
try {
std::regex_match("(cat)", rx);
} catch (std::exception& e) {
puts("regex_match threw instead: oops!");
puts(e.what());
}
}
The output is:
Constructed without throwing: oops!
regex_match threw instead: oops!
The expression contained an invalid back reference.
I claim that the constructor should detect and throw on this pattern, rather
than throwing at match time. The same issue happens with the "std::regex::grep"
dialect, too.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs