https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84159
Bug ID: 84159 Summary: filesystem::path::operator/= with has root directory path Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: faithandbrave at gmail dot com Target Milestone: --- Standard says: N4660 30.10.8.4.3 path appends [fs.path.append] // On POSIX, path("foo") / ""; // yields "foo/" path("foo") / "/bar"; // yields "/bar" However, 2nd line yields "foo/bar". #include <iostream> #include <filesystem> namespace fs = std::filesystem; int main() { fs::path p = "foo"; p /= "/bar"; std::cout << << p << std::endl; }