https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113246
--- Comment #5 from Davide Pesavento <davidepesa at gmail dot com> --- (In reply to Jonathan Wakely from comment #2) > > If there are no leading elements of p that exist, should canonical() be > > called with an empty path? or should it not be called at all? > > It makes no sense for weakly_canonical to ever call canonical with an empty > path, since that would always report an error (i.e. throw or set ec and > return an empty path). That would make it completely useless for paths with > no prefix that already exists. So if there are no leading elements of p that > exist, then obviously canonical should not be called. The alternative makes > no sense. > > So the behaviour of weakly_canonical seems correct to me. If any leading > elements exist, then canonical is called on them, which returns an absolute > path, and then the non-existing elements are appended to that. If there are > no existing elements, then you get a relative path. Thanks. Not the answer I was hoping for(*) but I guess it does make sense logically. (*) because it means that weakly_canonical("foo") and weakly_canonical("./foo") give different results. I guess weakly_canonical(absolute(whatever)) is what I need (in most cases).