John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -std=c++0x -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks %s |
| 2 | |
| 3 | // "Move" semantics, trivial version. |
| 4 | void move_it(__strong id &&from) { |
| 5 | id to = static_cast<__strong id&&>(from); |
| 6 | } |
| 7 | |
| 8 | // Deduction with 'auto'. |
| 9 | @interface A |
| 10 | + alloc; |
| 11 | - init; |
| 12 | @end |
| 13 | |
| 14 | // Ensure that deduction works with lifetime qualifiers. |
| 15 | void deduction(id obj) { |
| 16 | auto a = [[A alloc] init]; |
| 17 | __strong A** aPtr = &a; |
| 18 | |
| 19 | auto a2([[A alloc] init]); |
| 20 | __strong A** aPtr2 = &a2; |
| 21 | |
| 22 | __strong id *idp = new auto(obj); |
| 23 | |
| 24 | __strong id array[17]; |
| 25 | for (auto x : array) { |
| 26 | __strong id *xPtr = &x; |
| 27 | } |
| 28 | } |