fork download
  1. #include <cassert>
  2. #include <cerrno>
  3. #include <system_error>
  4. #include <iostream>
  5.  
  6. int main() {
  7. ::std::cout << static_cast< int >(ENOENT) << ::std::endl;
  8. ::std::cout << static_cast< int >(::std::errc::no_such_file_or_directory) << ::std::endl;
  9. try {
  10. throw std::system_error(ENOENT, std::system_category());
  11. } catch (std::system_error const & e) {
  12. assert(e.code().value() == static_cast< int >(std::errc::no_such_file_or_directory)); // <- FAILS!?
  13. }
  14. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
2
2