Another test for objective-c type comparison.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45271 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2007-12-20 22:53:29 +00:00
Родитель 0f01debd47
Коммит cfc8738b8a
1 изменённых файлов: 36 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,36 @@
// RUN: clang -fsyntax-only -verify %s
#include <objc/objc.h>
@protocol MyProtocol
- (void) foo;
@end
@interface MyClass
@end
int main()
{
id obj = nil;
id<MyProtocol> obj_p = nil;
MyClass *obj_c = nil;
Class obj_C = Nil;
/* All these casts should generate no warnings. */
obj = (id)obj_p;
obj = (id)obj_c;
obj = (id)obj_C;
obj_c = (MyClass *)obj;
obj_c = (MyClass *)obj_p;
obj_c = (MyClass *)obj_C;
obj_p = (id<MyProtocol>)obj;
obj_p = (id<MyProtocol>)obj_c;
obj_p = (id<MyProtocol>)obj_C;
obj_C = (Class)obj;
obj_C = (Class)obj_p;
obj_C = (Class)obj_c;
return 0;
}