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.

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

Section: 31.12.13.27 [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 31.12.4 [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 31.12.13.27 [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).