blob: fa022af522e924914123b4883ea11c54caf8acb4 [file] [log] [blame]
Argyrios Kyrtzidis17b63992011-07-01 22:22:40 +00001// RUN: %clang_cc1 -std=c++0x -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks -fobjc-exceptions %s
John McCallf85e1932011-06-15 23:02:42 +00002
3// "Move" semantics, trivial version.
4void 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.
15void 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 }
Argyrios Kyrtzidis17b63992011-07-01 22:22:40 +000028
29 @try {
30 } @catch (auto e) { // expected-error {{'auto' not allowed in exception declaration}}
31 }
John McCallf85e1932011-06-15 23:02:42 +000032}