https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99430
Bug ID: 99430 Summary: std::filesystem::path: UNC device paths with \\?\… not supported properly Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: moritz at bunkus dot org Target Milestone: --- Created attachment 50317 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50317&action=edit test case highlighting the issue Paths such as \\?\C:\WINDOWS or \\?\UNC\LOCALHOST\c$\WINDOWS don't work properly with std::filesystem::path (e.g. exists() & is_directory() return false). According to Microsoft's documentation those are valid.[1] The corresponding variants starting with \\.\ seem to fare better (safe for the root name & absolute issues, but I've filed 99333 for that already). boost::filesystem works fine with all of these paths. The attached sample program outputs the following, showing how Boost's & std's implementation differ: ----------------------------------------- std::filesystem::path for \\?\C:\WINDOWS is_aboslute 0 has_root_path 1 has_root_name 0 exists 0 is_directory 0 boost::filesystem::path for \\?\C:\WINDOWS is_aboslute 1 has_root_path 1 has_root_name 1 exists 1 is_directory 1 std::filesystem::path for \\?\UNC\localhost\c$\WINDOWS is_aboslute 0 has_root_path 1 has_root_name 0 exists 0 is_directory 0 boost::filesystem::path for \\?\UNC\localhost\c$\WINDOWS is_aboslute 1 has_root_path 1 has_root_name 1 exists 1 is_directory 1 std::filesystem::path for \\.\C:\WINDOWS is_aboslute 0 has_root_path 1 has_root_name 0 exists 1 is_directory 1 boost::filesystem::path for \\.\C:\WINDOWS is_aboslute 1 has_root_path 1 has_root_name 1 exists 1 is_directory 1 std::filesystem::path for \\.\UNC\localhost\c$\WINDOWS is_aboslute 0 has_root_path 1 has_root_name 0 exists 1 is_directory 1 boost::filesystem::path for \\.\UNC\localhost\c$\WINDOWS is_aboslute 1 has_root_path 1 has_root_name 1 exists 1 is_directory 1 ----------------------------------------- gcc mingw 10.2.0 from MXE (cross-compiling from Linux to Windows), Boost 1.74.0 [1] https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats