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 // Test unique_ptr converting move assignment
16 // Can't assign from const lvalue
22 #include "../deleter.h"
28 A(const A&) {++count;}
29 virtual ~A() {--count;}
39 B(const B&) {++count;}
40 virtual ~B() {--count;}
49 const boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
52 boost::unique_ptr<A[], Deleter<A>&> s2(new A, da);
54 assert(s2.get() == p);
56 assert(A::count == 1);
57 assert(B::count == 1);
58 assert(s2.get_deleter().state() == 5);
60 assert(A::count == 0);
61 assert(B::count == 0);