diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-10-16 00:47:59 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-10-16 00:47:59 +0000 |
commit | 1e1bbc7437f4679ce8b6ed5984f2cc72a96f3349 (patch) | |
tree | da4a8c0faacfeffd0c728283e7238818360b065f | |
parent | 451f34db162fddec235736bc0ee0c670ad452e2a (diff) |
Implement LWG 2712 and update other issues status
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284318 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | src/experimental/filesystem/operations.cpp | 6 | ||||
-rw-r--r-- | test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp | 28 | ||||
-rw-r--r-- | www/upcoming_meeting.html | 12 |
3 files changed, 38 insertions, 8 deletions
diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index 4c60a17e9..6c7e4cf24 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -282,6 +282,10 @@ bool __copy_file(const path& from, const path& to, copy_options options, } const bool to_exists = exists(to_st); + if (to_exists && !is_regular_file(to_st)) { + set_or_throw(make_error_code(errc::not_supported), ec, "copy_file", from, to); + return false; + } if (to_exists && bool(copy_options::skip_existing & options)) { return false; } @@ -302,6 +306,8 @@ bool __copy_file(const path& from, const path& to, copy_options options, set_or_throw(make_error_code(errc::file_exists), ec, "copy", from, to); return false; } + + _LIBCPP_UNREACHABLE(); } void __copy_symlink(const path& existing_symlink, const path& new_symlink, diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp index ac9877bbd..1b56c7097 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp @@ -153,12 +153,36 @@ TEST_CASE(copy_dir_test) scoped_test_env env; const path file = env.create_file("file1", 42); const path dest = env.create_dir("dir1"); - std::error_code ec; + std::error_code ec = GetTestEC(); TEST_CHECK(fs::copy_file(file, dest, ec) == false); TEST_CHECK(ec); - ec.clear(); + TEST_CHECK(ec != GetTestEC()); + ec = GetTestEC(); TEST_CHECK(fs::copy_file(dest, file, ec) == false); TEST_CHECK(ec); + TEST_CHECK(ec != GetTestEC()); +} + +TEST_CASE(non_regular_file_test) +{ + scoped_test_env env; + const path fifo = env.create_fifo("fifo"); + const path dest = env.make_env_path("dest"); + const path file = env.create_file("file", 42); + { + std::error_code ec = GetTestEC(); + TEST_REQUIRE(fs::copy_file(fifo, dest, ec) == false); + TEST_CHECK(ec); + TEST_CHECK(ec != GetTestEC()); + TEST_CHECK(!exists(dest)); + } + { + std::error_code ec = GetTestEC(); + TEST_REQUIRE(fs::copy_file(file, fifo, copy_options::overwrite_existing, ec) == false); + TEST_CHECK(ec); + TEST_CHECK(ec != GetTestEC()); + TEST_CHECK(is_fifo(fifo)); + } } TEST_SUITE_END() diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html index cb781a432..682455420 100644 --- a/www/upcoming_meeting.html +++ b/www/upcoming_meeting.html @@ -100,10 +100,10 @@ <tr><td><a href="http://wg21.link/LWG2694">2694</a></td><td>Application of LWG 436 accidentally deleted definition of "facet"</td><td>Issaquah</td><td>Nothing to do</td></tr> <tr><td><a href="http://wg21.link/LWG2696">2696</a></td><td>Interaction between make_shared and enable_shared_from_this is underspecified</td><td>Issaquah</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2699">2699</a></td><td>Missing restriction in [numeric.requirements]</td><td>Issaquah</td><td></td></tr> - <tr><td><a href="http://wg21.link/LWG2712">2712</a></td><td>copy_file(from, to, ...) has a number of unspecified error conditions</td><td>Issaquah</td><td></td></tr> - <tr><td><a href="http://wg21.link/LWG2722">2722</a></td><td>equivalent incorrectly specifies throws clause</td><td>Issaquah</td><td></td></tr> + <tr><td><a href="http://wg21.link/LWG2712">2712</a></td><td>copy_file(from, to, ...) has a number of unspecified error conditions</td><td>Issaquah</td><td>Implemented in trunk</td></tr> + <tr><td><a href="http://wg21.link/LWG2722">2722</a></td><td>equivalent incorrectly specifies throws clause</td><td>Issaquah</td><td>We already do this</td></tr> <tr><td><a href="http://wg21.link/LWG2729">2729</a></td><td>Missing SFINAE on std::pair::operator=</td><td>Issaquah</td><td></td></tr> - <tr><td><a href="http://wg21.link/LWG2732">2732</a></td><td>Questionable specification of path::operator/= and path::append</td><td>Issaquah</td><td></td></tr> + <tr><td><a href="http://wg21.link/LWG2732">2732</a></td><td>Questionable specification of path::operator/= and path::append</td><td>Issaquah</td><td>Nothing to do</td></tr> <tr><td><a href="http://wg21.link/LWG2733">2733</a></td><td>[fund.ts.v2] gcd / lcm and bool</td><td>Issaquah</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2735">2735</a></td><td>std::abs(short), std::abs(signed char) and others should return int instead of double in order to be compatible with C++98 and C</td><td>Issaquah</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2736">2736</a></td><td>nullopt_t insufficiently constrained</td><td>Issaquah</td><td></td></tr> @@ -178,10 +178,10 @@ <li>2694 - Restoring inadvertently deleted text. No code changes needed.</li> <li>2696 - I <b>suspect</b> that this is just better specification of the existing structure. Probably need more tests for this.</li> <li>2699 - I don't think this requires any code changes; look more closely.</li> -<li>2712 - File System; Eric?</li> -<li>2722 - File System; Eric?</li> +<li>2712 - LGTM. </li> +<li>2722 - LGTM </li> <li>2729 - </li> -<li>2732 - File System; Eric?</li> +<li>2732 - Our implementation is already equivalent. </li> <li>2733 - LFTS; same as 2759</li> <li>2735 - I <b>suspect</b> that this is just better specification of the existing structure. Probably need more tests for this.</li> <li>2736 - </li> |