[cfe-commits] r45271 - /cfe/trunk/test/Sema/objc-comptypes-2.m
Fariborz Jahanian
fjahanian at apple.com
Thu Dec 20 14:53:29 PST 2007
Author: fjahanian
Date: Thu Dec 20 16:53:29 2007
New Revision: 45271
URL: http://llvm.org/viewvc/llvm-project?rev=45271&view=rev
Log:
Another test for objective-c type comparison.
Added:
cfe/trunk/test/Sema/objc-comptypes-2.m
Added: cfe/trunk/test/Sema/objc-comptypes-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/objc-comptypes-2.m?rev=45271&view=auto
==============================================================================
--- cfe/trunk/test/Sema/objc-comptypes-2.m (added)
+++ cfe/trunk/test/Sema/objc-comptypes-2.m Thu Dec 20 16:53:29 2007
@@ -0,0 +1,36 @@
+// RUN: clang -fsyntax-only -verify %s
+
+#include <objc/objc.h>
+
+ at protocol MyProtocol
+- (void) foo;
+ at end
+
+ at interface MyClass
+ at 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;
+}
More information about the cfe-commits
mailing list