4

I'm under the impression that I'm supposed to be able to compare system category and generic category errors in the way I'm doing below. Am I missing something? When I do this with gcc, they compare as not equal.

#include <iostream>
#include <system_error>

int main()
{
    std::error_code s{ENOSPC, std::system_category()};
    auto g = std::errc::no_space_on_device;
    std::cout << (g == s) << std::endl;
}

1 Answer 1

4

This is a bug in gcc. It's corrected in the latest revisions as noted here. Fixed on all active branches, so will be fixed in the 6.5, 7.4, 8.3 and 9.1 releases.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60555

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.