unexpected.pass.cpp 541 B

1234567891011121314151617181920212223242526
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // test unexpected
  10. #include <exception>
  11. #include <cstdlib>
  12. #include <cassert>
  13. void f1()
  14. {
  15. std::exit(0);
  16. }
  17. int main()
  18. {
  19. std::set_unexpected(f1);
  20. std::unexpected();
  21. assert(false);
  22. }