This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
copy_file(from, to, ...)
has a number of unspecified error conditionsSection: 31.12.13.5 [fs.op.copy.file] Status: C++17 Submitter: Eric Fiselier Opened: 2016-05-10 Last modified: 2021-06-06
Priority: 2
View all other issues in [fs.op.copy.file].
View all issues with C++17 status.
Discussion:
There are a number of error cases that copy_file(from, to, ...)
does not take into account.
Specifically the cases where:
from
does not existfrom
is not a regular fileto
exists and is not a regular fileThese error cases should be specified as such.
[2016-05 Issues Telecon]
Eric to provide wording.
[2016-05-28, Eric Fiselier provides wording]
[2016-08 Chicago]
Wed AM: Move to Tentatively Ready
Proposed resolution:
This wording is relative to N4582.
Modify [fs.op.copy_file] as indicated:
bool copy_file(const path& from, const path& to, copy_options options); bool copy_file(const path& from, const path& to, copy_options options, error_code& ec) noexcept;-3- Requires: At most one constant from each
-4- Effects: Report a file already exists error as specified in Error reporting (27.5.6.5) if:copy_options
option group (27.10.10.2) is present inoptions
.
!is_regular_file(from)
, orexists(to)
and!is_regular_file(to)
, orexists(to)
andequivalent(from, to)
, orexists(to)
and(options & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing)) == copy_options::none
.