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