https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78167
Bug ID: 78167 Summary: experimental/filesystem calls behave differently between Linux gcc 5.3.0 and Windows Visual Studio 2015 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: david_bjornbak at keysight dot com Target Milestone: --- experimental/filesystem calls behave differently between Linux gcc 5.3.0 and Windows Visual Studio 2015. For example the following series of calls under a googletest configuration. It runs Ok on Window VS 2015 but, on Linux with gcc 5.3.0 , it throws errors and if you capture the error_code the fs::remove_all call will fail if you have sub directories to the "sandbox" directory. TEST(KPathTest, experimental_filesystem_itself) { // On Linux this throws, not windows std::error_code ec; fs::remove("somefile_thatdoesnotexist.txt",ec); std::cout << "ec for fs::remove " << ec.value() << "\n"; #ifndef _WIN32 // On Linux, clean up old failed test std::system("rm -rf sandbox"); #endif fs::create_directories("sandbox/1/2/a"); #ifdef _WIN32 // On Linux this throws, not windows EXPECT_FALSE(fs::create_directory("sandbox/1/2/a")); #endif fs::create_directory("sandbox/1/2/b"); fs::permissions("sandbox/1/2/b", fs::perms::remove_perms | fs::perms::others_all); fs::create_directory("sandbox/1/2/c", "sandbox/1/2/b"); #ifndef _WIN32 std::system("ls -l sandbox/1/2"); #endif // On Linux this throws and doesn't remove dir and on windows it's Ok fs::remove_all("sandbox",ec); std::cout << "ec for fs::remove_all " << ec.value() << "\n"; EXPECT_FALSE(fs::is_directory("sandbox")); }