1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <memory>
11 
12 // unique_ptr
13 
14 // Test unique_ptr move assignment
15 
16 #include <memory>
17 #include <cassert>
18 
19 // Can't copy from const lvalue
20 
21 struct A
22 {
23     static int count;
AA24     A() {++count;}
AA25     A(const A&) {++count;}
~AA26     ~A() {--count;}
27 };
28 
29 int A::count = 0;
30 
main()31 int main()
32 {
33     {
34     const std::unique_ptr<A> s(new A);
35     std::unique_ptr<A> s2;
36     s2 = s;
37     }
38 }
39