//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template shared_ptr(nullptr_t, D d, A a); #include #include #include "../test_deleter.h" #include "test_allocator.h" struct A { static int count; A() {++count;} A(const A&) {++count;} ~A() {--count;} }; int A::count = 0; int main() { try { test_allocator::throw_after = 0; std::shared_ptr p(nullptr, test_deleter(3), test_allocator(5)); assert(false); } catch (std::bad_alloc&) { assert(A::count == 0); assert(test_deleter::count == 0); assert(test_deleter::dealloc_count == 1); assert(test_allocator::count == 0); assert(test_allocator::alloc_count == 0); } }