2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify -fblocks %s
|
2008-12-11 01:49:55 +08:00
|
|
|
@protocol NSObject;
|
|
|
|
|
|
|
|
void bar(id(^)(void));
|
|
|
|
void foo(id <NSObject>(^objectCreationBlock)(void)) {
|
|
|
|
return bar(objectCreationBlock);
|
|
|
|
}
|
|
|
|
|
|
|
|
void bar2(id(*)(void));
|
|
|
|
void foo2(id <NSObject>(*objectCreationBlock)(void)) {
|
|
|
|
return bar2(objectCreationBlock);
|
|
|
|
}
|
|
|
|
|
|
|
|
void bar3(id(*)());
|
|
|
|
void foo3(id (*objectCreationBlock)(int)) {
|
|
|
|
return bar3(objectCreationBlock);
|
|
|
|
}
|
|
|
|
|
|
|
|
void bar4(id(^)());
|
|
|
|
void foo4(id (^objectCreationBlock)(int)) {
|
2009-04-01 09:17:39 +08:00
|
|
|
return bar4(objectCreationBlock);
|
2008-12-11 01:49:55 +08:00
|
|
|
}
|
2008-12-23 08:53:59 +08:00
|
|
|
|
2009-04-01 09:17:39 +08:00
|
|
|
void bar5(id(^)(void));
|
|
|
|
void foo5(id (^objectCreationBlock)(int)) {
|
|
|
|
return bar5(objectCreationBlock); // expected-warning{{incompatible block pointer types passing 'id (^)(int)', expected 'id (^)(void)'}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void bar6(id(^)(int));
|
|
|
|
void foo6(id (^objectCreationBlock)()) {
|
|
|
|
return bar6(objectCreationBlock); // expected-warning{{incompatible block pointer types passing 'id (^)()', expected 'id (^)(int)'}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void foo67(id (^x)(int)) {
|
2008-12-23 08:53:59 +08:00
|
|
|
if (x) { }
|
|
|
|
}
|