Index: test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp =================================================================== --- test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp +++ test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // test operator new[] // NOTE: asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete @@ -18,6 +17,8 @@ #include #include +#include "test_macros.h" + int new_handler_called = 0; void new_handler() @@ -36,6 +37,7 @@ int main() { +#ifndef TEST_HAS_NO_EXCEPTIONS std::set_new_handler(new_handler); try { @@ -51,6 +53,7 @@ { assert(false); } +#endif A* ap = new A[3]; assert(ap); assert(A_constructed == 3); Index: test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp =================================================================== --- test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp +++ test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // test operator new [] (nothrow) // NOTE: asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete @@ -18,6 +17,8 @@ #include #include +#include "test_macros.h" + int new_handler_called = 0; void new_handler() @@ -37,16 +38,20 @@ int main() { std::set_new_handler(new_handler); +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif TEST_HAS_NO_EXCEPTIONS { void*volatile vp = operator new [] (std::numeric_limits::max(), std::nothrow); assert(new_handler_called == 1); assert(vp == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (...) { assert(false); } +#endif A* ap = new(std::nothrow) A[3]; assert(ap); assert(A_constructed == 3); Index: test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp =================================================================== --- test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp +++ test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions - // test operator new // asan and msan will not call the new handler. @@ -19,6 +17,8 @@ #include #include +#include "test_macros.h" + int new_handler_called = 0; void new_handler() @@ -37,6 +37,7 @@ int main() { +#ifndef TEST_HAS_NO_EXCEPTIONS std::set_new_handler(new_handler); try { @@ -52,6 +53,7 @@ { assert(false); } +#endif A* ap = new A; assert(ap); assert(A_constructed); Index: test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp =================================================================== --- test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp +++ test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // test operator new (nothrow) // asan and msan will not call the new handler. @@ -18,6 +17,8 @@ #include #include +#include "test_macros.h" + int new_handler_called = 0; void new_handler() @@ -37,16 +38,20 @@ int main() { std::set_new_handler(new_handler); +#ifndef TEST_HAS_NO_EXCEPTIONS try +#endif { void* vp = operator new (std::numeric_limits::max(), std::nothrow); assert(new_handler_called == 1); assert(vp == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS catch (...) { assert(false); } +#endif A* ap = new(std::nothrow) A; assert(ap); assert(A_constructed);