This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
lexically_relative
on UNC drive paths (\\?\C:\...
) results in a default-constructed valueSection: 31.12.6.5.11 [fs.path.gen] Status: New Submitter: Nicole Mazzuca Opened: 2022-05-12 Last modified: 2022-05-17
Priority: 3
View all other issues in [fs.path.gen].
View all issues with New status.
Discussion:
As a resolution to LWG 3070(i), in path lexically_relative(const path& base) const
,
bullet 3.4 was added:
If: […] any filename in
relative_path()
orbase.relative_path()
can be interpreted as a root-name, […] returnspath()
.
This resolution was correct when we have really weird paths like abc\X:\c
, but the MSVC standard library
implementation treats UNC drive-relative paths as:
\\?\C:\foo\bar = { root-name = \\?, root-directory = \, relative-path = C:\foo\bar }
If we were able to go back in time, we might have root-name = \\?\C:
, but we can't make that
change at that point without silently breaking users; therefore, we believe it would be best to instead change
lexically_relative()
to work around this issue.
If
relative_path().has_root_path() && base.relative_path().has_root_path()
, andrelative_path().root_path() == base.relative_path().root_path()
, thenreturn relative_path().lexically_relative(base.relative_path())
.
[2022-05-17; Reflector poll]
Set priority to 3 after reflector poll.
Proposed resolution: