Implement LWG issue 2725. The issue should move this meeting

llvm-svn: 273325
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 310d3b975fd07bba9ac45fb1f05f6c951cb16ad7
diff --git a/include/experimental/filesystem b/include/experimental/filesystem
index a667c73..be7d23f 100644
--- a/include/experimental/filesystem
+++ b/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