Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Steve Naroff | ebaa768 | 2009-04-07 15:07:57 +0000 | [diff] [blame] | 3 | |
| 4 | #include <stddef.h> |
| 5 | |
| 6 | typedef struct objc_class *Class; |
| 7 | typedef struct objc_object { |
| 8 | Class isa; |
| 9 | } *id; |
| 10 | id objc_getClass(const char *s); |
| 11 | |
| 12 | @interface Object |
| 13 | + self; |
| 14 | @end |
| 15 | |
| 16 | @protocol Func |
| 17 | + (void) class_func0; |
| 18 | - (void) instance_func0; |
| 19 | @end |
| 20 | |
| 21 | @interface Derived: Object <Func> |
| 22 | @end |
| 23 | |
| 24 | @interface Derived2: Object <Func> |
| 25 | @end |
| 26 | |
Steve Naroff | 470301b | 2009-07-22 16:07:01 +0000 | [diff] [blame] | 27 | static void doSomething(Class <Func> unsupportedObjectType) { |
Steve Naroff | ebaa768 | 2009-04-07 15:07:57 +0000 | [diff] [blame] | 28 | [unsupportedObjectType class_func0]; |
| 29 | } |
| 30 | |
| 31 | static void doSomethingElse(id <Func> pleaseConvertToThisType) { |
| 32 | [pleaseConvertToThisType class_func0]; |
| 33 | } |
| 34 | |
| 35 | int main(int argv, char *argc[]) { |
| 36 | doSomething([Derived self]); |
| 37 | doSomething([Derived2 self]); |
| 38 | doSomethingElse([Derived self]); |
| 39 | doSomethingElse([Derived2 self]); |
| 40 | } |
| 41 | |