hanickadot / compile-time-regular-expressions

Compile Time Regular Expression in C++
https://twitter.com/hankadusikova
Apache License 2.0
3.22k stars 177 forks source link

Unreachable code in evaluate.hpp #295

Closed kapacuk closed 8 months ago

kapacuk commented 8 months ago

Line 222 in include/ctre/evaluation.hpp is unreachable, the if statement on line 206 returns from both branches:

if (multiline_mode(f)) {
        if (last == current) {
            return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
        } else if (*current == '\n') {
            return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
        } else {
            return not_matched;
        }
    } else {
        if (last != current) {
            return not_matched;
        }
        return evaluate(begin, current, last, f, captures, ctll::list<Tail...>());
    }
hanickadot commented 8 months ago

Thanks! Good catch!