1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 #include <stddef.h> 4 5 typedef struct objc_class *Class; 6 typedef struct objc_object { 7 Class isa; 8 } *id; 9 id objc_getClass(const char *s); 10 11 @interface Object 12 + self; 13 @end 14 15 @protocol Func 16 + (void) class_func0; 17 - (void) instance_func0; 18 @end 19 20 @interface Derived: Object <Func> 21 @end 22 23 @interface Derived2: Object <Func> 24 @end 25 26 static void doSomething(Class <Func> unsupportedObjectType) { 27 [unsupportedObjectType class_func0]; 28 } 29 30 static void doSomethingElse(id <Func> pleaseConvertToThisType) { 31 [pleaseConvertToThisType class_func0]; 32 } 33 34 int main(int argv, char *argc[]) { 35 doSomething([Derived self]); 36 doSomething([Derived2 self]); 37 doSomethingElse([Derived self]); 38 doSomethingElse([Derived2 self]); 39 } 40 41