https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93244
Bug ID: 93244 Summary: std::filesystem::path::generic_string doesn't convert the first slash on Windows Product: gcc Version: 9.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: orgads at gmail dot com Target Milestone: --- #include <filesystem> int main() { std::cout << std::filesystem::current_path().generic_string() << std::endl; } Prints F:\Projects/test/foo/bar/baz I debugged it a bit, and from https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/fs_path.h#L1136 I saw that the elements are: * _Root_name (F:) - __add_slash remains false * _Root_dir (\) - It is appended as it is (that's the bug), and __add_slash remains false * From this point, the elements are all _Filename, and forward slashes are appended.