This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] PR libstdc++/83306 make filesystem_error no-throw copyable
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 28 Nov 2018 16:52:24 +0000
- Subject: Re: [PATCH] PR libstdc++/83306 make filesystem_error no-throw copyable
- References: <20181128152704.GA24994@redhat.com>
On 28/11/18 15:27 +0000, Jonathan Wakely wrote:
The class API provides no way to modify the members, so we can share
them between copies of the same object. Copying becomes a simple
reference count update, which doesn't throw.
Also adjust the what() string to allow distinguishing between an empty
path passed to the constructor, and no path.
PR libstdc++/83306
* include/bits/fs_path.h (filesystem_error): Move data members into
pimpl class owned by shared_ptr. Remove inline definitions of member
functions.
* src/filesystem/std-path.cc (filesystem_error::_Impl): Define.
(filesystem_error): Define member functions.
* testsuite/27_io/filesystem/filesystem_error/cons.cc: New test.
* testsuite/27_io/filesystem/filesystem_error/copy.cc: New test.
Tested x86_64-linux, committed to trunk.
Ops, this broke he TS implementation:
FAIL: experimental/filesystem/operations/remove.cc (test for excess errors)
Excess errors:
/home/jwakely/src/gcc/libstdc++-v3/src/filesystem/path.cc:505: undefined reference to `std::filesystem::fs_err_concat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Fix coming up ...