diff options
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.cc | 18 |
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(); } |