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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu May 16 23:00:26 2019
New Revision: 271301

URL: https://gcc.gnu.org/viewcvs?rev=271301&root=gcc&view=rev
Log:
PR libstdc++/90299 make filesystem::absolute overloads consistent

In this implementation it is an error to pass the empty path to absolute,
because the empty path doesn't represent any file in the filesystem so
the function cannot meet its postcondition.

Currently the absolute(const path&, error_code&) overload reports an
error for the empty path, but using errc::no_such_file_or_directory, and
the other overload does not report an error. This patch makes them
consistntly report an errc::invalid_argument error for the empty path.

Backport from mainline
2019-05-04  Jonathan Wakely  <jwak...@redhat.com>

        PR libstdc++/90299
        * src/c++17/fs_ops.cc (absolute(const path&)): Report an error if the
        argument is an empty path.
        (absolute(const path&, error_code&)): Use invalid_argument as error
        code instead of no_such_file_or_directory.
        * testsuite/27_io/filesystem/operations/absolute.cc: Check handling
        of non-existent paths and empty paths with both overloads of absolute.

Backport from mainline
2019-05-16  Jonathan Wakely  <jwak...@redhat.com>

        * src/c++17/fs_ops.cc (absolute(const path&, error_code&))
        [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Remove bogus assertion.

Modified:
    branches/gcc-9-branch/libstdc++-v3/ChangeLog
    branches/gcc-9-branch/libstdc++-v3/src/c++17/fs_ops.cc
   
branches/gcc-9-branch/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc

Reply via email to