[PATCH] D42693: [libcxx] Handle invalid escaped characters in POSIX regex
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 30 13:06:55 PST 2018
Quuxplusone added inline comments.
================
Comment at: include/regex:3465
+ case '{':
+ case '}':
+ break;
----------------
FWIW, I don't understand what's going on in this switch.
Is it intentional that `'('` and `'|'` now take different paths here?
================
Comment at: test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp:60
+ assert(!error_escape_thrown("\\.", basic));
+ assert(!error_escape_thrown("\\*", basic));
}
----------------
I would think about adding test cases here to document the intended behavior of
- "\\n" and "\\t" which are valid of course;
- "\\\n" which could be a common typo and should probably throw;
- "\\/" which is common in Perl but maybe should throw anyway;
- "\\1" in a regex mode that doesn't support backreferences;
- "\\0".
If these are already covered elsewhere in the suite, then never mind me.
https://reviews.llvm.org/D42693
More information about the cfe-commits
mailing list