2849. Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?

Section: 30.11.14.4 [fs.op.copy_file] Status: New Submitter: Tim Song Opened: 2016-12-17 Last modified: 2017-02-02

Priority: 2

View other active issues in [fs.op.copy_file].

View all other issues in [fs.op.copy_file].

View all issues with New status.

Discussion:

30.11.14.4 [fs.op.copy_file]/4 says that copy_file reports "a file already exists error as specified in [fs.err.report] if" any of several error conditions exist.

It's not clear how some of those error conditions, such as !is_regular_file(from), can be sensibly described as "file already exists". Pretty much everywhere else in the filesystem specification just says "an error" without further elaboration.

[2017-01-27 Telecon]

Priority 2; Jonathan to provide updated wording.

Proposed resolution:

This wording is relative to N4618.

  1. Edit [fs.op.copy_file]/4 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;
    

    -4- Effects: As follows:

    1. (4.1) — Report a file already existsan error as specified in 30.11.6 [fs.err.report] if:

      1. (4.1.1) —[…]

    2. (4.2) —[…]