This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

3026. filesystem::weakly_canonical still defined in terms of canonical(p, base)

Section: 31.12.13.40 [fs.op.weakly.canonical] Status: C++20 Submitter: Jonathan Wakely Opened: 2017-10-14 Last modified: 2021-06-06

Priority: 0

View all other issues in [fs.op.weakly.canonical].

View all issues with C++20 status.

Discussion:

LWG 2956(i) fixed canonical to no longer use a base path, but weakly_canonical should have been changed too:

Effects: Using status(p) or status(p, ec), respectively, to determine existence, return a path composed by operator/= from the result of calling canonical() without a base argument and with a […]

Since canonical doesn't accept a base argument, it doesn't make sense to talk about calling it without one.

[ 2017-10-16 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

[2018-3-17 Adopted in Jacksonville]

Proposed resolution:

This wording is relative to N4687.

  1. Change [fs.op.weakly_canonical] as indicated:

    path weakly_canonical(const path& p);
    path weakly_canonical(const path& p, error_code& ec);
    

    -1- Returns: […]

    -2- Effects: Using status(p) or status(p, ec), respectively, to determine existence, return a path composed by operator/= from the result of calling canonical() without a base argument and with a path argument composed of the leading elements of p that exist, if any, followed by the elements of p that do not exist, if any. For the first form, canonical() is called without an error_code argument. For the second form, canonical() is called with ec as an error_code argument, and path() is returned at the first error occurrence, if any.

    […]