https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90370
Bug ID: 90370 Summary: Does 0 correspond to a POSIX errno value for std::system_category? Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- The C++ standard says in [syserr.errcat.objects]: "If the argument ev corresponds to a POSIX errno value posv, the function shall return error_condition(posv, generic_category()). Otherwise, the function shall return error_condition(ev, system_category()). What constitutes correspondence for any given operating system is unspecified." Our current implementation (in src/c++11/system_error.cc) does not consider 0 to correspond to a POSIX errno value. I did that because there is no EXXX macro defined by POSIX with value zero, as all error numbers are required to be positive values. Libc++ and Boost.System do consider 0 to correspond to a POSIX errno value, meaning "no error" (and Boost even defines the boost::system::errc::success enumerator with the value zero). I think both positions can be justified. Zero is not an errno value, but it does have special meaning. Should we change our implementation?