| //===----------------------------------------------------------------------===// |
| // The LLVM Compiler Infrastructure |
| // This file is dual licensed under the MIT and the University of Illinois Open |
| // Source Licenses. See LICENSE.TXT for details. |
| //===----------------------------------------------------------------------===// |
| // Test unique_ptr move assignment |
| // test move assignment. Should only require a MoveConstructible deleter, or if |
| // deleter is a reference, not even that. |
| #include "deleter_types.h" |
| std::unique_ptr<A[]> s1(new A[3]); |
| std::unique_ptr<A[]> s2(new A[2]); |
| std::unique_ptr<A[], Deleter<A[]> > s1(new A[4], Deleter<A[]>(5)); |
| std::unique_ptr<A[], Deleter<A[]> > s2(new A[5]); |
| assert(s2.get_deleter().state() == 5); |
| assert(s1.get_deleter().state() == 0); |
| std::unique_ptr<A[], CDeleter<A[]>&> s1(new A[6], d1); |
| std::unique_ptr<A[], CDeleter<A[]>&> s2(new A[3], d2); |