1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 // template<class Y, class D> shared_ptr(Y* p, D d);
16 // UNSUPPORTED: sanitizer-new-delete
22 #include "../test_deleter.h"
29 A(const A&) {++count;}
35 bool throw_next = false;
37 void* operator new(std::size_t s) throw(std::bad_alloc)
40 throw std::bad_alloc();
41 return std::malloc(s);
44 void operator delete(void* p) throw()
55 std::shared_ptr<A> p(ptr, test_deleter<A>(3));
58 catch (std::bad_alloc&)
60 assert(A::count == 0);
61 assert(test_deleter<A>::count == 0);
62 assert(test_deleter<A>::dealloc_count == 1);