Home | History | Annotate | Download | only in unique.ptr.runtime
      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 <utility>
     18 #include <cassert>
     19 
     20 // Can't copy from const lvalue
     21 
     22 struct A
     23 {
     24     static int count;
     25     A() {++count;}
     26     A(const A&) {++count;}
     27     ~A() {--count;}
     28 };
     29 
     30 int A::count = 0;
     31 
     32 int main()
     33 {
     34     {
     35     const std::unique_ptr<A[]> s(new A[3]);
     36     std::unique_ptr<A[]> s2;
     37     s2 = s;
     38     }
     39 }
     40