throws_assign_fail.cpp 453 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 Peter Dimov.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. #include <boost/system/error_code.hpp>
  4. using namespace boost::system;
  5. static void f( error_code & ec )
  6. {
  7. ec = error_code();
  8. }
  9. #if defined(_WIN32)
  10. # include <windows.h> // SetErrorMode
  11. #endif
  12. int main()
  13. {
  14. #if defined(_WIN32)
  15. SetErrorMode( SetErrorMode( 0 ) | SEM_NOGPFAULTERRORBOX );
  16. #endif
  17. // this should crash
  18. f( boost::throws() );
  19. }