https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71037

            Bug ID: 71037
           Summary: Exceptions thrown from "filesystem::canonical(...)"
                    should contain both paths.
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric at efcs dot ca
  Target Milestone: ---

The filesystem error thrown from canonical only contains the first path, not
the base. Since the base path can be user specified the exception should
contain this as well.

#include <experimental/filesystem>
#include <cassert>

using namespace std::experimental::filesystem;

int main() {
  const path p = "DNE"
  const path base = "BASE";
  try {
    canonical(p, base);
    assert(false);
  } catch (filesystem_error const& err) {
    assert(err.path1() == p);
    assert(err.path2() == base); // FIRES
  }
}

Reply via email to