blob: e713d239a0cfbda668b81a634079fc23d3178d4e [file] [log] [blame]
John McCallf85e1932011-06-15 23:02:42 +00001// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-nonfragile-abi -verify %s
2
3// rdar://8843524
4
5struct A {
6 id x; // expected-error {{ARC forbids Objective-C objects in structs or unions}}
7};
8
9union 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
24struct S {
Argyrios Kyrtzidisb8b03132011-06-24 00:08:59 +000025 id __attribute__((objc_ownership(none))) i;
John McCallf85e1932011-06-15 23:02:42 +000026 void * vp;
27 int i1;
28};
29
30// rdar://9046528
31
32@class NSError;
33
Argyrios Kyrtzidisb8b03132011-06-24 00:08:59 +000034__autoreleasing id X; // expected-error {{global variables cannot have __autoreleasing ownership}}
35__autoreleasing NSError *E; // expected-error {{global variables cannot have __autoreleasing ownership}}
John McCallf85e1932011-06-15 23:02:42 +000036
37
Argyrios Kyrtzidisb8b03132011-06-24 00:08:59 +000038extern id __autoreleasing X1; // expected-error {{global variables cannot have __autoreleasing ownership}}
John McCallf85e1932011-06-15 23:02:42 +000039
40void func()
41{
42 id X;
Argyrios Kyrtzidisb8b03132011-06-24 00:08:59 +000043 static id __autoreleasing X1; // expected-error {{global variables cannot have __autoreleasing ownership}}
44 extern id __autoreleasing E; // expected-error {{global variables cannot have __autoreleasing ownership}}
John McCallf85e1932011-06-15 23:02:42 +000045
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