diff options
Diffstat (limited to 'test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp')
| -rw-r--r-- | test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp index 2e761d70bba0..2fa975eca833 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp @@ -8,17 +8,20 @@ //===----------------------------------------------------------------------===// // XFAIL: libcpp-no-exceptions +// UNSUPPORTED: sanitizer-new-delete + // <memory> // template<class Y> explicit shared_ptr(Y* p); -// UNSUPPORTED: sanitizer-new-delete #include <memory> #include <new> #include <cstdlib> #include <cassert> +#include "count_new.hpp" + struct A { static int count; @@ -30,26 +33,12 @@ struct A int A::count = 0; -bool throw_next = false; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - if (throw_next) - throw std::bad_alloc(); - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - std::free(p); -} int main() { - { A* ptr = new A; - throw_next = true; assert(A::count == 1); + globalMemCounter.throw_after = 0; try { std::shared_ptr<A> p(ptr); @@ -59,5 +48,5 @@ int main() { assert(A::count == 0); } - } + assert(globalMemCounter.checkOutstandingNewEq(0)); } |
