https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86910
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Fri Feb 8 12:20:22 2019 New Revision: 268685 URL: https://gcc.gnu.org/viewcvs?rev=268685&root=gcc&view=rev Log: PR libstdc++/86910 fix filesystem::create_directories Implement the proposed semantics from P1164R0, which reverts the changes of LWG 2935. This means that failure to create a directory because a non-directory already exists with that name will be reported as an error. While rewriting the function, also fix PR 87846, which is a result of the C++17 changes to how a trailing slash on a path affects the last component of a path. Backport from mainline 2018-11-29 Jonathan Wakely <jwak...@redhat.com> PR libstdc++/86910 PR libstdc++/87846 * src/filesystem/ops.cc (experimental::create_directories): Report an error when the path resolves to an existing non-directory (P1164). * src/filesystem/std-ops.cc (create_directories): Likewise. Handle empty filenames due to trailing slashes. * testsuite/27_io/filesystem/operations/create_directories.cc: Test when some component of the path exists and is not a directory. Test trailing slashes. * testsuite/experimental/filesystem/operations/create_directories.cc: Likewise. Modified: branches/gcc-8-branch/libstdc++-v3/ChangeLog branches/gcc-8-branch/libstdc++-v3/src/filesystem/ops.cc branches/gcc-8-branch/libstdc++-v3/src/filesystem/std-ops.cc branches/gcc-8-branch/libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc branches/gcc-8-branch/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directories.cc