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 // The deleter is not called if get() == 0
19 #include "test_macros.h"
26 Deleter& operator=(Deleter&);
29 Deleter() : state_(0) {}
31 int state() const {return state_;}
33 void operator()(void*) {++state_;}
39 assert(d.state() == 0);
41 std::unique_ptr<int[], Deleter&> p(nullptr, d);
43 assert(&p.get_deleter() == &d);
45 #if defined(_LIBCPP_VERSION)
47 // The standard only requires the constructor accept nullptr, but libc++
48 // also supports the literal 0.
49 std::unique_ptr<int[], Deleter&> p(0, d);
51 assert(&p.get_deleter() == &d);
54 assert(d.state() == 0);