equivalent
incorrectly specifies throws clauseSection: 31.12.13.13 [fs.op.equivalent] Status: C++17 Submitter: Eric Fiselier Opened: 2016-05-28 Last modified: 2017-07-30
Priority: 3
View all other issues in [fs.op.equivalent].
View all issues with C++17 status.
Discussion:
The spec for equivalent
has a throws clause which reads: [fs.op.equivalent]/5
Throws:
filesystem_error
if(!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))
, otherwise as specified in Error reporting (27.10.7).
This explicit requirement to throw is incorrect for the equivalent
overload which takes an error_code
.
Previous resolution [SUPERSEDED]:
This wording is relative to N4582.
Modify 31.12.13.13 [fs.op.equivalent] as follows:
bool equivalent(const path& p1, const path& p2); bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept;-1- Effects: Determines
-2- Returns: Iffile_status s1
ands2
, as if bystatus(p1)
andstatus(p2)
, respectively.(!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))
an error is reported (31.12.5 [fs.err.report]). Otherwisetrue
, ifs1 == s2
andp1
andp2
resolve to the same file system entity, elsefalse
. The signature with argumentec
returnsfalse
if an error occurs. -3- Two paths are considered to resolve to the same file system entity if two candidate entities reside on the same device at the same location. This is determined as if by the values of the POSIXstat
structure, obtained as if bystat()
for the two paths, having equalst_dev
values and equalst_ino
values. -4- Throws:As specified infilesystem_error
if(!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))
, otherwise aEerror reporting (31.12.5 [fs.err.report]).
[2016-06 Oulu — Daniel provides wording improvements]
mc: do we have an error reporting clause?
jw: there is no such clause
gr: it should go into the effects clause
dk: we have the same issue for file_size
dk: the right place is the effects clause
[2016-08 Chicago]
Wed AM: Move to Tentatively Ready
Proposed resolution:
This wording is relative to N4594.
Modify 31.12.13.13 [fs.op.equivalent] as follows:
bool equivalent(const path& p1, const path& p2); bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept;-1- Let
-2- Effects: Determiness1
ands2
befile_status
s, determined as if bystatus(p1)
andstatus(p2)
, respectively.s1
ands2
. If(!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))
an error is reported (31.12.5 [fs.err.report]). -3- Returns:true
, ifs1 == s2
andp1
andp2
resolve to the same file system entity, elsefalse
. The signature with argumentec
returnsfalse
if an error occurs. -4- Two paths are considered to resolve to the same file system entity if two candidate entities reside on the same device at the same location. This is determined as if by the values of the POSIXstat
structure, obtained as if bystat()
for the two paths, having equalst_dev
values and equalst_ino
values. -5- Throws:As specified infilesystem_error
if(!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))
, otherwise aEerror reporting (31.12.5 [fs.err.report]).