1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config ipa=dynamic-bifurcate -verify %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuctypedef signed char BOOL; 4*f4a2713aSLionel Sambuc@protocol NSObject - (BOOL)isEqual:(id)object; @end 5*f4a2713aSLionel Sambuc@interface NSObject <NSObject> {} 6*f4a2713aSLionel Sambuc+(id)alloc; 7*f4a2713aSLionel Sambuc-(id)init; 8*f4a2713aSLionel Sambuc+(id)new; 9*f4a2713aSLionel Sambuc-(id)autorelease; 10*f4a2713aSLionel Sambuc-(id)copy; 11*f4a2713aSLionel Sambuc- (Class)class; 12*f4a2713aSLionel Sambuc-(id)retain; 13*f4a2713aSLionel Sambuc@end 14*f4a2713aSLionel Sambucvoid clang_analyzer_eval(BOOL); 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc@interface SomeOtherClass : NSObject 17*f4a2713aSLionel Sambuc- (int)getZero; 18*f4a2713aSLionel Sambuc@end 19*f4a2713aSLionel Sambuc@implementation SomeOtherClass 20*f4a2713aSLionel Sambuc- (int)getZero { return 0; } 21*f4a2713aSLionel Sambuc@end 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc@interface MyClass : NSObject 24*f4a2713aSLionel Sambuc- (int)getZero; 25*f4a2713aSLionel Sambuc@end 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc@implementation MyClass 28*f4a2713aSLionel Sambuc- (int)getZero { return 1; } 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc// TODO: Not only we should correctly determine that the type of o at runtime 31*f4a2713aSLionel Sambuc// is MyClass, but we should also warn about it. 32*f4a2713aSLionel Sambuc+ (void) testCastToParent { 33*f4a2713aSLionel Sambuc id a = [[self alloc] init]; 34*f4a2713aSLionel Sambuc SomeOtherClass *o = a; 35*f4a2713aSLionel Sambuc clang_analyzer_eval([o getZero] == 0); // expected-warning{{FALSE}} 36*f4a2713aSLionel Sambuc} 37*f4a2713aSLionel Sambuc@end 38