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 ctor
20 // Can't construct from lvalue
26 A(const A&) {++count;}
27 virtual ~A() {--count;}
37 B(const B&) {++count;}
38 virtual ~B() {--count;}
46 std::unique_ptr<B> s(new B);
48 std::unique_ptr<A> s2(s);
49 assert(s2.get() == p);
51 assert(A::count == 1);
52 assert(B::count == 1);
54 assert(A::count == 0);
55 assert(B::count == 0);