Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 #define nil (void *)0;
      4 #define Nil (void *)0;
      5 
      6 @protocol MyProtocol
      7 - (void) foo;
      8 @end
      9 
     10 @interface MyClass
     11 @end
     12 
     13 int main()
     14 {
     15   id obj = nil;
     16   id<MyProtocol> obj_p = nil;
     17   MyClass *obj_c = nil;
     18   Class obj_C = Nil;
     19 
     20   /* All these casts should generate no warnings.  */
     21 
     22   obj = (id)obj_p;
     23   obj = (id)obj_c;
     24   obj = (id)obj_C;
     25   obj_c = (MyClass *)obj;
     26   obj_c = (MyClass *)obj_p;
     27   obj_c = (MyClass *)obj_C;
     28   obj_p = (id<MyProtocol>)obj;
     29   obj_p = (id<MyProtocol>)obj_c;
     30   obj_p = (id<MyProtocol>)obj_C;
     31   obj_C = (Class)obj;
     32   obj_C = (Class)obj_p;
     33   obj_C = (Class)obj_c;
     34   
     35 
     36   return 0;
     37 }
     38