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
20 #include "../deleter.h"
26 A(const A&) {++count;}
27 virtual ~A() {--count;}
37 B(const B&) {++count;}
38 virtual ~B() {--count;}
46 boost::unique_ptr<B[], Deleter<B> > s(new B);
48 boost::unique_ptr<A[], Deleter<A> > s2(new A);
49 assert(A::count == 2);
50 s2 = (boost::move(s));
51 assert(s2.get() == p);
53 assert(A::count == 1);
54 assert(B::count == 1);
55 assert(s2.get_deleter().state() == 5);
56 assert(s.get_deleter().state() == 0);
58 assert(A::count == 0);
59 assert(B::count == 0);