Skip to content

[libc++] <regex>: \00 should be rejected #135048

Open
@Alcaro

Description

@Alcaro
#include <regex>
#include <stdio.h>

int main() {
    try {
        std::regex r{"\\00"};
        puts("valid");
    } catch (const std::exception& e) {
        printf("not valid: %s\n", e.what());
    }
    try {
        std::regex r{"\\01"};
        puts("valid");
    } catch (const std::exception& e) {
        printf("not valid: %s\n", e.what());
    }
}

Expected: Reject them. 00 and 01 do not match DecimalIntegerLiteral in the JS spec, and lookahead can't be a digit either.
Actual: Both are valid. (Can't find what they're actually parsed as, though.)

https://godbolt.org/z/heM1o1aGe (MS-STL is busy fixing it microsoft/STL#5380)

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.regexIssues related to regex

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions