| commit | 310d3b975fd07bba9ac45fb1f05f6c951cb16ad7 | [log] [tgz] |
|---|---|---|
| author | Eric Fiselier <eric@efcs.ca> | Tue Jun 21 22:11:16 2016 +0000 |
| committer | Eric Fiselier <eric@efcs.ca> | Tue Jun 21 22:11:16 2016 +0000 |
| tree | f6467f371c37ab215eda731f4772c1d419392eaa | |
| parent | 606a338db9c3cc1fc446111e1d11193f93ba1c5b [diff] |
Implement LWG issue 2725. The issue should move this meeting llvm-svn: 273325
diff --git a/libcxx/include/experimental/filesystem b/libcxx/include/experimental/filesystem index a667c73..be7d23f 100644 --- a/libcxx/include/experimental/filesystem +++ b/libcxx/include/experimental/filesystem
@@ -1393,7 +1393,9 @@ inline _LIBCPP_INLINE_VISIBILITY bool exists(const path& __p, error_code& __ec) _NOEXCEPT { - return exists(__status(__p, &__ec)); + auto __s = __status(__p, &__ec); + if (status_known(__s)) __ec.clear(); + return exists(__s); } inline _LIBCPP_INLINE_VISIBILITY
diff --git a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp index 460b8be..252ced6 100644 --- a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp +++ b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp
@@ -65,6 +65,10 @@ { const path p = StaticEnv::DNE; TEST_CHECK(exists(p) == false); + + std::error_code ec = GetTestEC(); + TEST_CHECK(exists(p, ec) == false); + TEST_CHECK(!ec); } TEST_CASE(test_exists_fails)