https://bugs.llvm.org/show_bug.cgi?id=51686
Bug ID: 51686
Summary: No exception is thrown when an invalid character range
(e.g., [b-a]) is included.
Product: libc++
Version: 12.0
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Standards Issues
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
---
#include <regex>
#include <cassert>
#include <cstdio>
static bool error_range_thrown(const char *pat)
{
bool result = false;
try {
std::regex re(pat);
} catch (const std::regex_error &ex) {
puts("regex_error");
fflush(stdout);
result = (ex.code() == std::regex_constants::error_range);
}
return result;
}
int main(int, char**)
{
assert(error_range_thrown("([b-a])"));
}
---
This program is created using the regular expression sample described in the
C++ language standard, but it did not throw an exception (as expected).
(e.g., Table 132 in
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4713.pdf)
I've confirmed that this problem can be reproduced using clang 13.0.0 "[C++]
clang HEAD 13.0.0 (https://github.com/llvm/llvm-project.git
c4ed142e695f14ba5675ec6d12226ee706329a0f)" on Wandbox (https://wandbox.org/).
This code throws the exception on gcc-10.1.0 (or other gcc version).
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs