[Bug libstdc++/101510] std::filesystem::create_directory on an existing symlink to a directory

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 20 11:43:53 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101510

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Madhu from comment #0)
> However create_directory(p) fails when p is a symbolic link which points
> to an existing directory.

No it doesn't.

It returns false to tell you that it didn't create a directory, but "no error
is reported" as required by the specification. Returning false is not reporting
an error. If create_directory(p) reports an error then it throws an exception
of type filesystem_error, see
https://en.cppreference.com/w/cpp/filesystem/create_directory#Exceptions

Are you misunderstanding the function's semantics?


More information about the Gcc-bugs mailing list