PR libstdc++/83306 make filesystem_error no-throw copyable
authorJonathan Wakely <jwakely@redhat.com>
Wed, 28 Nov 2018 15:27:11 +0000 (15:27 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 28 Nov 2018 15:27:11 +0000 (15:27 +0000)
commit24d9b090fb4b9a260fedb4489392ebd509e93202
tree7ddbccf4a6ee351ff8e14101617b9248b3e46049
parent2b4be50093f6b2afb337bc7dded0274b46ce9b31
PR libstdc++/83306 make filesystem_error no-throw copyable

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.

From-SVN: r266565
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fs_path.h
libstdc++-v3/src/filesystem/std-path.cc
libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/cons.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/copy.cc [new file with mode: 0644]