xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/ivar-access-package.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc// expected-no-diagnostics
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuctypedef unsigned char BOOL;
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@interface NSObject {
7*f4a2713aSLionel Sambuc  id isa;
8*f4a2713aSLionel Sambuc}
9*f4a2713aSLionel Sambuc+new;
10*f4a2713aSLionel Sambuc+alloc;
11*f4a2713aSLionel Sambuc-init;
12*f4a2713aSLionel Sambuc-autorelease;
13*f4a2713aSLionel Sambuc@end
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc@interface NSAutoreleasePool : NSObject
16*f4a2713aSLionel Sambuc- drain;
17*f4a2713aSLionel Sambuc@end
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc@interface A : NSObject {
20*f4a2713aSLionel Sambuc@package
21*f4a2713aSLionel Sambuc    id object;
22*f4a2713aSLionel Sambuc}
23*f4a2713aSLionel Sambuc@end
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc@interface B : NSObject
26*f4a2713aSLionel Sambuc- (BOOL)containsSelf:(A*)a;
27*f4a2713aSLionel Sambuc@end
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc@implementation A
30*f4a2713aSLionel Sambuc@end
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambuc@implementation B
33*f4a2713aSLionel Sambuc- (BOOL)containsSelf:(A*)a {
34*f4a2713aSLionel Sambuc    return a->object == self;
35*f4a2713aSLionel Sambuc}
36*f4a2713aSLionel Sambuc@end
37*f4a2713aSLionel Sambuc
38*f4a2713aSLionel Sambucvoid NSLog(id, ...);
39*f4a2713aSLionel Sambuc
40*f4a2713aSLionel Sambucint main (int argc, const char * argv[]) {
41*f4a2713aSLionel Sambuc    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
42*f4a2713aSLionel Sambuc    A *a = [[A new] autorelease];
43*f4a2713aSLionel Sambuc    B *b = [[B new] autorelease];
44*f4a2713aSLionel Sambuc    NSLog(@"%s", [b containsSelf:a] ? "YES" : "NO");
45*f4a2713aSLionel Sambuc    [pool drain];
46*f4a2713aSLionel Sambuc    return 0;
47*f4a2713aSLionel Sambuc}
48*f4a2713aSLionel Sambuc
49