std::filesystem::relative bug in Mingw or msvc?

289 Views Asked by At

I have the following code snipped, which produces the following output on mingw(gcc) and msvc:

std::cout << std::filesystem::relative("D:/home/freddy", "C:/home") << std::endl;

mingw(gcc):

"\\home\\freddy"

msvc:

""

gcc and also clang (both executed on linux):

"../../D:/home/freddy"

In my opinion it should be "" or "../../D:/home/freddy", since there is no relative path over root_paths, but not the relative path of an erased root path.

Additionally MSVC will fail, when the drive does not exist, because the drive is "not ready yet": weakly_canonical: Das Gerõt ist nicht bereit.: "D:/home/freddy" Which also seems like a MSVC bug in std::filesystem::weakly_canonical

0

There are 0 best solutions below