-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed as not planned
Labels
duplicateResolved as duplicateResolved as duplicatelibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.regexIssues related to regexIssues related to regex
Description
#include <regex>
int main()
{
try {
std::regex r("[\\d-e]");
puts("it's legal");
} catch (std::exception& e) {
puts(e.what());
}
try {
std::regex r("[b-a]");
puts("it's legal");
} catch (std::exception& e) {
puts(e.what());
}
}https://godbolt.org/z/oMvEr5YTs
Output: The expression contained an invalid character range, such as [b-a] in most encodings. and it's legal
Expected behavior: I'd expect that if I can produce an error saying that [b-a] is invalid, then an input of [b-a] returns that same error.
(Also, if you change it to [1-0], it's illegal in all encodings. The C and C++ specs demand that 0-9 are ascending and consecutive.)
Metadata
Metadata
Assignees
Labels
duplicateResolved as duplicateResolved as duplicatelibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.regexIssues related to regexIssues related to regex