Steve Naroff | c0febd5 | 2008-12-10 17:49:55 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify -fblocks %s |
| 2 | @protocol NSObject; |
| 3 | |
| 4 | void bar(id(^)(void)); |
| 5 | void foo(id <NSObject>(^objectCreationBlock)(void)) { |
| 6 | return bar(objectCreationBlock); |
| 7 | } |
| 8 | |
| 9 | void bar2(id(*)(void)); |
| 10 | void foo2(id <NSObject>(*objectCreationBlock)(void)) { |
| 11 | return bar2(objectCreationBlock); |
| 12 | } |
| 13 | |
| 14 | void bar3(id(*)()); |
| 15 | void foo3(id (*objectCreationBlock)(int)) { |
| 16 | return bar3(objectCreationBlock); |
| 17 | } |
| 18 | |
| 19 | void bar4(id(^)()); |
| 20 | void foo4(id (^objectCreationBlock)(int)) { |
| 21 | return bar4(objectCreationBlock); // expected-warning{{incompatible block pointer types passing 'id (^)(int)', expected 'id (^)()'}} |
| 22 | } |
Douglas Gregor | 2a7e58d | 2008-12-23 00:53:59 +0000 | [diff] [blame^] | 23 | |
| 24 | void foo5(id (^x)(int)) { |
| 25 | if (x) { } |
| 26 | } |