https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111091
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> --- Thanks for the report. Although the behavior may seem surprising I believe it's working as specified. The string literal "/" when treated as a range includes the null terminator, so we're actually splitting at occurrences of '/' followed by '\0', of which there are none in the input string. The corresponding std::string or std::string_view doesn't include the null terminator and so does the expected thing.