https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106461
Bug ID: 106461
Summary: filesystem::path("//.").parent_path() results in
path("/") and not path("//")
Product: gcc
Version: 12.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: services+gccbugs at vasama dot org
Target Milestone: ---
path("//.").parent_path().string() returns "/"s and not "//"s as might be
expected.
path("//").parent_path().string() returns "//"s as expected.
https://godbolt.org/z/sT5zn7zM9
#include <filesystem>
#include <cassert>
int main() {
assert(std::filesystem::path("//").parent_path().string() == "//");
assert(std::filesystem::path("//.").parent_path().string() == "//");
}