John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-nonfragile-abi -verify %s |
| 2 | |
| 3 | // rdar://8843524 |
| 4 | |
| 5 | struct A { |
| 6 | id x; // expected-error {{ARC forbids Objective-C objects in structs or unions}} |
| 7 | }; |
| 8 | |
| 9 | union u { |
| 10 | id u; // expected-error {{ARC forbids Objective-C objects in structs or unions}} |
| 11 | }; |
| 12 | |
| 13 | @interface I { |
| 14 | struct A a; |
| 15 | struct B { |
| 16 | id y[10][20]; // expected-error {{ARC forbids Objective-C objects in structs or unions}} |
| 17 | id z; |
| 18 | } b; |
| 19 | |
| 20 | union u c; |
| 21 | }; |
| 22 | @end |
| 23 | |
| 24 | struct S { |
| 25 | id __attribute__((objc_lifetime(none))) i; |
| 26 | void * vp; |
| 27 | int i1; |
| 28 | }; |
| 29 | |
| 30 | // rdar://9046528 |
| 31 | |
| 32 | @class NSError; |
| 33 | |
| 34 | __autoreleasing id X; // expected-error {{global variables cannot have __autoreleasing lifetime}} |
| 35 | __autoreleasing NSError *E; // expected-error {{global variables cannot have __autoreleasing lifetime}} |
| 36 | |
| 37 | |
| 38 | extern id __autoreleasing X1; // expected-error {{global variables cannot have __autoreleasing lifetime}} |
| 39 | |
| 40 | void func() |
| 41 | { |
| 42 | id X; |
| 43 | static id __autoreleasing X1; // expected-error {{global variables cannot have __autoreleasing lifetime}} |
| 44 | extern id __autoreleasing E; // expected-error {{global variables cannot have __autoreleasing lifetime}} |
| 45 | |
| 46 | } |
| 47 | |
| 48 | // rdar://9157348 |
| 49 | |
| 50 | @interface J |
| 51 | @property (retain) id newFoo; // expected-note {{property declared here}} |
| 52 | @property (strong) id copyBar; // expected-note {{property declared here}} |
| 53 | @property (copy) id allocBaz; // expected-note {{property declared here}} |
| 54 | @property (copy, nonatomic) id new; |
| 55 | @end |
| 56 | |
| 57 | @implementation J |
| 58 | @synthesize newFoo; // expected-error {{property's synthesized getter follows Cocoa naming convention for returning}} |
| 59 | @synthesize copyBar; // expected-error {{property's synthesized getter follows Cocoa naming convention for returning}} |
| 60 | @synthesize allocBaz; // expected-error {{property's synthesized getter follows Cocoa naming convention for returning}} |
| 61 | @synthesize new; |
| 62 | - new {return 0; }; |
| 63 | @end |
| 64 | |