aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2019-05-07 17:31:12 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2019-05-07 17:31:12 +0000
commiteec33732a01453baedb2598c6997bad6a39d9e1e (patch)
tree15c52c0770d845cf0053e959a8b998cda7ddec25 /libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc
parent6ffaf63f736250e03afb9974fe5a32b50c69bdef (diff)
parenta91db438b583050311a6eb845d05775b14e09f1d (diff)
svn merge -r270931:270974 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branchredhat/gcc-8-branch
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/redhat/gcc-8-branch@270976 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc')
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc
index e8391f46e2d..20d2d880f08 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/assign/copy.cc
@@ -21,6 +21,7 @@
#include <filesystem>
#include <testsuite_fs.h>
+#include <testsuite_hooks.h>
using std::filesystem::path;
using __gnu_test::compare_paths;
@@ -48,9 +49,26 @@ test02()
}
}
+void
+test03()
+{
+ // self assignment should have no effect
+ const path orig = "foo/bar/baz";
+ path p = orig;
+ const auto ptr1 = p.c_str();
+ const auto ptr2 = p.begin()->c_str();
+ p = std::move(p);
+ __gnu_test::compare_paths(p, orig);
+ p = p;
+ __gnu_test::compare_paths(p, orig);
+ VERIFY( ptr1 == p.c_str() );
+ VERIFY( ptr2 == p.begin()->c_str() );
+}
+
int
main()
{
test01();
test02();
+ test03();
}