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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 5 11:48:20 PDT 2024


================
@@ -35,7 +35,12 @@ int main(int, char**) {
   {
     const std::error_category& e_cat1 = std::system_category();
     std::error_condition e_cond       = e_cat1.default_error_condition(5);
+#ifdef _WIN32
+    // Windows' system error 5 is ERROR_ACCESS_DENIED, which maps to generic code permission_denied.
+    LIBCPP_ASSERT(e_cond.value() == static_cast<int>(std::errc::permission_denied));
+#else
----------------
ldionne wrote:

So IIUC this test was always making an incorrect assumption, it just happened to work because our mapping between the system and generic categories was the identity function. Right?

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


More information about the libcxx-commits mailing list