Home | History | Annotate | Download | only in tests
      1 #include <cassert>
      2 #include <exception>
      3 
      4 void throw_exception() {
      5   throw 1;
      6 }
      7 
      8 int main() {
      9   std::set_unexpected(throw_exception);
     10   try {
     11     std::unexpected(); // it is OK to throw exception from std::unexpected()
     12     assert(false);
     13   } catch (int) {
     14     assert(true);
     15   } catch (...) {
     16     assert(false);
     17   }
     18   return 0;
     19 }
     20