Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <memory> |
| 11 | |
| 12 | // unique_ptr |
| 13 | |
| 14 | // Test unique_ptr converting move assignment |
| 15 | |
| 16 | // Do not convert from an array unique_ptr |
| 17 | |
| 18 | #include <memory> |
Marshall Clow | 6b913d7 | 2015-01-09 20:25:52 +0000 | [diff] [blame] | 19 | #include <utility> |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 20 | #include <cassert> |
| 21 | |
| 22 | struct A |
| 23 | { |
| 24 | }; |
| 25 | |
| 26 | struct Deleter |
| 27 | { |
| 28 | void operator()(void*) {} |
| 29 | }; |
| 30 | |
| 31 | int main() |
| 32 | { |
| 33 | std::unique_ptr<A[], Deleter> s; |
| 34 | std::unique_ptr<A, Deleter> s2; |
Dan Albert | 1d4a1ed | 2016-05-25 22:36:09 -0700 | [diff] [blame^] | 35 | s2 = std::move(s); |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 36 | } |