1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s 2*f4a2713aSLionel Sambuc// expected-no-diagnostics 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc// Test function pointer casts. 5*f4a2713aSLionel Sambuctypedef void* (*MyFuncTest1)(void); 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel SambucMyFuncTest1 test1_aux(void); 8*f4a2713aSLionel Sambucvoid test1(void) { 9*f4a2713aSLionel Sambuc void *x; 10*f4a2713aSLionel Sambuc void* (*p)(void); 11*f4a2713aSLionel Sambuc p = ((void*) test1_aux()); 12*f4a2713aSLionel Sambuc if (p != ((void*) 0)) x = (*p)(); 13*f4a2713aSLionel Sambuc} 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc// Test casts from void* to function pointers. 16*f4a2713aSLionel Sambucvoid* test2(void *p) { 17*f4a2713aSLionel Sambuc MyFuncTest1 fp = (MyFuncTest1) p; 18*f4a2713aSLionel Sambuc return (*fp)(); 19*f4a2713aSLionel Sambuc} 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc// <radar://10087620> 22*f4a2713aSLionel Sambuc// A cast from int onjective C property reference to int. 23*f4a2713aSLionel Sambuctypedef signed char BOOL; 24*f4a2713aSLionel Sambuc@protocol NSObject - (BOOL)isEqual:(id)object; @end 25*f4a2713aSLionel Sambuc@interface NSObject <NSObject> {} - (id)init; @end 26*f4a2713aSLionel Sambuctypedef enum { 27*f4a2713aSLionel Sambuc EEOne, 28*f4a2713aSLionel Sambuc EETwo 29*f4a2713aSLionel Sambuc} RDR10087620Enum; 30*f4a2713aSLionel Sambuc@interface RDR10087620 : NSObject { 31*f4a2713aSLionel Sambuc RDR10087620Enum elem; 32*f4a2713aSLionel Sambuc} 33*f4a2713aSLionel Sambuc@property (readwrite, nonatomic) RDR10087620Enum elem; 34*f4a2713aSLionel Sambuc@end 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambucstatic void 37*f4a2713aSLionel Sambucadium_media_ready_cb(RDR10087620 *InObj) 38*f4a2713aSLionel Sambuc{ 39*f4a2713aSLionel Sambuc InObj.elem |= EEOne; 40*f4a2713aSLionel Sambuc} 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc// PR16690 44*f4a2713aSLionel Sambuc_Bool testLocAsIntegerToBool() { 45*f4a2713aSLionel Sambuc return (long long)&testLocAsIntegerToBool; 46*f4a2713aSLionel Sambuc} 47