Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Steve Naroff | ebaa768 | 2009-04-07 15:07:57 +0000 | [diff] [blame] | 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 | |
Steve Naroff | 470301b | 2009-07-22 16:07:01 +0000 | [diff] [blame] | 26 | static void doSomething(Class <Func> unsupportedObjectType) { |
Steve Naroff | ebaa768 | 2009-04-07 15:07:57 +0000 | [diff] [blame] | 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 | |