[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:24 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
----------------
jyknight wrote:
Yep. `system_category::default_error_condition` is supposed to create an error_candition in generic_category (if possible), using the `system_category` value specified. There's no guarantee that `system_category` value 5 maps to `generic_category` value 5, but it did before.
https://github.com/llvm/llvm-project/pull/93101
More information about the libcxx-commits
mailing list