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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to devl from comment #0)
> Created attachment 49480 [details]
> Full output with -v
> 
> std::filesystem::copy() with copy_options = copy_symlinks |
> overwrite_existing does not overwrite existing symlinks. Instead it produces
> the following error:
> 
> terminate called after throwing an instance of
> 'std::filesystem::__cxx11::filesystem_error'
>   what():  filesystem error: cannot copy: Invalid argument [link] [link_copy]

I think that's the behaviour specified by the standard, see [fs.op.copy] p4
bullet (4.6).

Or the equivalent description at
https://en.cppreference.com/w/cpp/filesystem/copy

  If from is a symbolic link, then 

  - If copy_options::skip_symlink is present in options, does nothing.
  - Otherwise, if to does not exist and copy_options::copy_symlinks is present
in options, then behaves as if copy_symlink(from, to)
  - Otherwise, reports an error

Reply via email to