Make sure test suite/examples/bench compile with exceptions disabled (exception-handling=off)

This commit is contained in:
Ion Gaztañaga
2020-10-22 01:12:59 +02:00
parent 03f030af69
commit 4bebeb2353
16 changed files with 399 additions and 323 deletions
+9 -6
View File
@@ -86,20 +86,23 @@ void test_null_memory_resource()
{
//Make sure it throw or returns null
memory_resource *mr = null_memory_resource();
BOOST_TEST(mr != 0);
#if !defined(BOOST_NO_EXCEPTIONS)
bool bad_allocexception_thrown = false;
try{
BOOST_TRY{
mr->allocate(1, 1);
}
catch(std::bad_alloc&) {
BOOST_CATCH(std::bad_alloc&) {
bad_allocexception_thrown = true;
}
catch(...) {
BOOST_CATCH(...) {
}
BOOST_CATCH_END
BOOST_TEST(bad_allocexception_thrown == true);
#else
BOOST_TEST(0 == mr->allocate(1, 1));
#endif
#endif //BOOST_NO_EXCEPTIONS
}
void test_default_resource()