PR libstdc++/83306 make filesystem_error no-throw copyable
commit8092d42a27bb2a8c45d8219b95532e92ffa152ac
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Nov 2018 15:27:11 +0000 (28 15:27 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Nov 2018 15:27:11 +0000 (28 15:27 +0000)
tree7ddbccf4a6ee351ff8e14101617b9248b3e46049
parent4cb390b29cd6ca0940990383fe2571cd341d2fe0
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266565 138bc75d-0d04-0410-961f-82ee72b054a4
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]