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