]> git.ipfire.org Git - thirdparty/gcc.git/commit
Make filesystem::path safe for self assignment
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Apr 2019 16:56:14 +0000 (16:56 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 5 Apr 2019 16:56:14 +0000 (16:56 +0000)
commitaa9c570e47f7165b74deedf80e72cd39ce58a90a
treeafbf6b6816e29fd29cd900906f354e82fde3df91
parent781cb64dd4198453ac273ee160e27b1087479044
Make filesystem::path safe for self assignment

The standard says "If *this and p are the same object, has no effect."
Previously we ended up clearing the path.

* include/bits/fs_path.h (path::operator=(path&&)): Check for self
assignment.
* src/c++17/fs_path.cc (path::operator=(const path&)): Likewise.
* testsuite/27_io/filesystem/path/assign/copy.cc: Test self
assignment.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270171 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fs_path.h
libstdc++-v3/src/c++17/fs_path.cc
libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc