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.

### 2956. `filesystem::canonical()` still defined in terms of `absolute(p, base)`

Section: 31.12.13.3 [fs.op.canonical] Status: C++17 Submitter: Sergey Zubkov Opened: 2017-04-21 Last modified: 2020-09-06

Priority: 1

View all issues with C++17 status.

Discussion:

This is from editorial issue #1620:

Since the resolution of US-78 was applied (as part of P0492R2), `std::filesystem::absolute(path, base)` no longer exists. However, `std::filesystem::canonical` is still defined in terms of `absolute(p, base)`.

[2017-06-27 P1 after 5 positive votes on c++std-lib]

Davis Herring: This needs to be P1 — due to a wording gap in P0492R2, 2 out of the 3 overloads of `filesystem::canonical()` have bad signatures and are unimplementable.

[2017-07-14, Toronto, Davis Herring provides wording]

[2017-07-14, Toronto, Moved to Immediate]

Proposed resolution:

This wording is relative to N4659.

1. Edit 31.12.4 [fs.filesystem.syn] as indicated:

   >     path canonical(const path& p, const path& base = current_path());
   >     path canonical(const path& p, error_code& ec);
   >     path canonical(const path& p, const path& base, error_code& ec);

2. Edit 31.12.13.3 [fs.op.canonical] as indicated:

   >     path canonical(const path& p, const path& base = current_path());
   >     path canonical(const path& p, error_code& ec);
   >     path canonical(const path& p, const path& base, error_code& ec);

   > > -1- Effects: Converts `p`, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements in its pathname in the generic format.

   > > -2- Returns: A path that refers to the same file system object as `absolute(p, base)`. For the overload without a `base` argument, `base` is `current_path()`. Signatures The signature with argument `ec` returns `path()` if an error occurs.

   > > […]