[libcxx-commits] [libcxx] [libcxx] Handle windows system error code mapping in std::error_code. (PR #93101)

James Y Knight via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 13 15:07:25 PDT 2024


================
@@ -172,8 +172,12 @@ static void test_with_ec_dne() {
     file_status st = status(p, status_ec);
     file_status sym_st = symlink_status(p, sym_status_ec);
     std::error_code ec = GetTestEC(2);
-    auto CheckEC = [&](std::error_code const& other_ec) {
-      bool res = ec == other_ec;
+    auto CheckEC                  = [&](std::error_code const& other_ec) {
+      // We compare the canonicalized error_conditions for this case, because
+      // directory_entry may construct its own generic_category error when a
+      // file doesn't exist, instead of directly returning a system_category
+      // error.
----------------
jyknight wrote:

The point is that, in other tests we do test exact error_code equality, but here we don't. I've tried to reword it to make that clearer.

https://github.com/llvm/llvm-project/pull/93101


More information about the libcxx-commits mailing list