* _LIGHTLIBCPP_NO_EXCEPTIONS and _LIGHTLIBCPP_NO_RTTI are set automatically with...
[lightlibc++.git] / testcase / cstdlib / quick_exit-exceptions.cpp
blob9dd0e77c48b6ec6a3c7325c850d9be9a6d489f67
1 /*
2 Permission is granted to use, modify, and / or redistribute at will.
4 This includes removing authorship notices, re-use of code parts in
5 other software (with or without giving credit), and / or creating a
6 commercial product based on it.
8 This permission is not revocable by the author.
10 This software is provided as-is. Use it at your own risk. There is
11 no warranty whatsoever, neither expressed nor implied, and by using
12 this software you accept that the author(s) shall not be held liable
13 for any loss of data, loss of service, or other damages, be they
14 incidental or consequential. Your only option other than accepting
15 this is not to use the software at all.
17 #include <cstdlib>
18 #include <exception>
19 // TODO: #include <cassert>
20 #include <assert.h>
23 * Check that the quick_exit function calls std::terminate when a handler
24 * leaks an exception
27 #if !defined(_LIGHTLIBCPP_CPP03_STRICT) && \
28 !defined(_LIGHTLIBCPP_NO_EXCEPTIONS)
30 void f()
32 throw std::exception();
35 int main()
37 assert(std::at_quick_exit(f) == 0);
38 std::quick_exit(EXIT_SUCCESS);
40 return EXIT_FAILURE;
43 #else
45 int main()
47 return EXIT_SUCCESS;
50 #endif