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;
}
Mike
  • 693
  • 3
  • 13

1 Answers1

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

Mike
  • 693
  • 3
  • 13