1// TEST_CONFIG 2 3// DO NOT include anything else here 4#include <objc/objc.h> 5// DO NOT include anything else here 6Class c = Nil; 7SEL s; 8IMP i; 9id o = nil; 10BOOL b = YES; 11BOOL b2 = NO; 12#if !__has_feature(objc_arc) 13__strong void *p; 14#endif 15id __unsafe_unretained u; 16id __weak w; 17 18void fn(void) __unused; 19void fn(void) { 20 id __autoreleasing a __unused; 21} 22 23#if __llvm__ && !__clang__ 24// llvm-gcc defines _NSConcreteGlobalBlock wrong 25#else 26// rdar://10118972 wrong type inference for blocks returning YES and NO 27BOOL (^block1)(void) = ^{ return YES; }; 28BOOL (^block2)(void) = ^{ return NO; }; 29#endif 30 31#include "test.h" 32 33int main() 34{ 35 testassert(YES); 36 testassert(!NO); 37#if __cplusplus 38 testwarn("rdar://12371870 -Wnull-conversion"); 39 testassert(!(bool)nil); 40 testassert(!(bool)Nil); 41#else 42 testassert(!nil); 43 testassert(!Nil); 44#endif 45 46#if __has_feature(objc_bool) 47 // YES[array] is disallowed for objc just as true[array] is for C++ 48#else 49 // this will fail if YES and NO do not have enough parentheses 50 int array[2] = { 888, 999 }; 51 testassert(NO[array] == 888); 52 testassert(YES[array] == 999); 53#endif 54 55 succeed(__FILE__); 56} 57