blob: 3acddb71e7c87da5787c8e41a0150b27d4c7ed65 [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -x objective-c %s.result
2// RUN: arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c %s > %t
John McCall8f0e8d22011-06-15 23:25:17 +00003// RUN: diff %t %s.result
Argyrios Kyrtzidisd8b42162012-01-12 02:34:32 +00004// DISABLE: mingw32
John McCall8f0e8d22011-06-15 23:25:17 +00005
6typedef unsigned char BOOL;
7
8@interface NSObject {
9 id isa;
10}
11+new;
12+alloc;
13-init;
14-autorelease;
15@end
16
17@interface NSAutoreleasePool : NSObject
18- drain;
19@end
20
21@interface A : NSObject {
22@package
23 id object;
24}
25@end
26
27@interface B : NSObject
28- (BOOL)containsSelf:(A*)a;
29@end
30
31@implementation A
32@end
33
34@implementation B
35- (BOOL)containsSelf:(A*)a {
36 return a->object == self;
37}
38@end
39
40void NSLog(id, ...);
41
42int main (int argc, const char * argv[]) {
43 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
44 A *a = [[A new] autorelease];
45 B *b = [[B new] autorelease];
46 NSLog(@"%s", [b containsSelf:a] ? "YES" : "NO");
47 [pool drain];
48 return 0;
49}