https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86910
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Steffen Schuemann from comment #3) > gcc version 8.0.1 20180414 (experimental) [trunk revision 259383] (Ubuntu > 8-20180414-1ubuntu2) Why are you using a pre-release snapshot from 4 months ago when the 8.1 and 8.2 releases have been made since then? > I see, that LWG defect 2935 addresses this question. But first, my > understanding is a defect in WP status is still not part of the standard, so > it might become part of some C++20 or some TC, but it currently doesn't seem > to be part of C++17 (selected by -std=c++17). I might be wrong with that. It's a defect in C++17. We implement the fixes, not implement a standard that is known to be defective. Why would you want a pedantic adherence to a defective standard? Do you also want compiler bugs to go unfixed, because they were present in past releases? :-) Anyway, the manual says what -std=c++17 means: "The 2017 ISO C++ standard plus amendments." https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html > And second, I still I don't really see how this is expected to be used by > the developers usinf std::fs. Without that postcondition you have to do a > check for the directory before using that it, so the "spared" call was > simply moved to the user code. Not testing could lead to harder to track > down bugs later on in a different domain of the software. Yes, I agree. I don't think pushing the is_directory check onto users is helpful, but that's what the Defect Report resolution says. I was discussing it recently with the developer of libc++'s std::filesystem implementation and I think we both fail to meet the spec for create_directory (as you noted in comment 4). I'm not sure what libc++ does for create_directories. I haven't changed create_directory, because I like its current behaviour. I haven't changed create_directories because it was accidentally already doing what 2935 wants, and intentionally changing to disagree with the spec seems wrong. i.e. inertia has won. > And third, as testing for existence and type can be done with one call, That's true for my implementation of create_directories, but not for create_directory, where you don't need to test for existence. You call mkdir and if it returns EEXIST you know it already exists. To see if it's a directory requires another system call (which I currently do). I've now asked the standard committee to reconsider whether we made the right call on 2935. I'll confirm this, because whatever happens create_directory and create_directories should be consistent, so I'll need to change one of them.