diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp --- a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp @@ -28,7 +28,7 @@ typename List::iterator i = l1.insert(next(l1.cbegin()), 5, 4); assert(i == next(l1.begin())); assert(l1 == List(a2, a2+8)); -#ifndef TEST_HAS_NO_EXCEPTIONS +#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT) globalMemCounter.throw_after = 4; int save_count = globalMemCounter.outstanding_new; try diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp @@ -39,18 +39,16 @@ int main(int, char**) { - globalMemCounter.throw_after = 0; - try - { - std::shared_ptr p(nullptr, test_deleter(3)); - assert(false); - } - catch (std::bad_alloc&) - { - assert(A::count == 0); - assert(test_deleter::count == 0); - assert(test_deleter::dealloc_count == 1); - } - +#if !defined(DISABLE_NEW_COUNT) + globalMemCounter.throw_after = 0; + try { + std::shared_ptr p(nullptr, test_deleter(3)); + assert(false); + } catch (std::bad_alloc&) { + assert(A::count == 0); + assert(test_deleter::count == 0); + assert(test_deleter::dealloc_count == 1); + } +#endif return 0; } diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp @@ -37,21 +37,19 @@ int main(int, char**) { - globalMemCounter.reset(); - A* ptr = new A; - globalMemCounter.throw_after = 0; - try - { - std::shared_ptr p(ptr, test_deleter(3)); - assert(false); - } - catch (std::bad_alloc&) - { - assert(A::count == 0); - assert(test_deleter::count == 0); - assert(test_deleter::dealloc_count == 1); - } - assert(globalMemCounter.checkOutstandingNewEq(0)); - +#if !defined(DISABLE_NEW_COUNT) + globalMemCounter.reset(); + A* ptr = new A; + globalMemCounter.throw_after = 0; + try { + std::shared_ptr p(ptr, test_deleter(3)); + assert(false); + } catch (std::bad_alloc&) { + assert(A::count == 0); + assert(test_deleter::count == 0); + assert(test_deleter::dealloc_count == 1); + } + assert(globalMemCounter.checkOutstandingNewEq(0)); +#endif return 0; } diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp @@ -81,7 +81,7 @@ assert(p.get() == raw_ptr); assert(ptr.get() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS +#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT) assert(A::count == 0); { std::unique_ptr ptr(new A);