2719. permissions function should not be noexcept due to narrow contract

Section: 30.11.14.26 [fs.op.permissions] Status: C++17 Submitter: Eric Fiselier Opened: 2016-05-28 Last modified: 2017-07-30

Priority: 0

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

View all issues with C++17 status.

Discussion:

Currently the signatures for permissions are:

void permissions(const path& p, perms prms);
void permissions(const path& p, perms prms, error_code& ec) noexcept;

However both overloads have a narrow contract since due to the requires clause:

Requires: !((prms & perms::add_perms) != perms::none && (prms & perms::remove_perms) != perms::none).

For this reason I believe the second overload of permissions should not be marked noexcept.

[2016-06 Oulu]

Moved to P0/Ready during issues prioritization.

Friday: status to Immediate

Proposed resolution:

This wording is relative to N4582.

  1. Change 30.11.5 [fs.filesystem.syn] as indicated:

    namespace std::filesystem {
      […]
    
      void permissions(const path& p, perms prms);
      void permissions(const path& p, perms prms, error_code& ec) noexcept;
    
      […]
    }
    
  2. Change 30.11.14.26 [fs.op.permissions] as indicated:

    void permissions(const path& p, perms prms);
    void permissions(const path& p, perms prms, error_code& ec) noexcept;
    

    -1- Requires: !((prms & perms::add_perms) != perms::none && (prms & perms::remove_perms) != perms::none).