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