brintos

brintos / llvm-project-archived public Read only

0
0
Text · 743 B · ff5ff4e Raw
49 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// expected-no-diagnostics3 4typedef unsigned char BOOL;5 6@interface NSObject {7  id isa;8}9+new;10+alloc;11-init;12-autorelease;13@end14 15@interface NSAutoreleasePool : NSObject16- drain;17@end18 19@interface A : NSObject {20@package21    id object;22}23@end24 25@interface B : NSObject26- (BOOL)containsSelf:(A*)a;27@end28 29@implementation A30@end31 32@implementation B33- (BOOL)containsSelf:(A*)a {34    return a->object == self;35}36@end37 38void NSLog(id, ...);39 40int 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