2008-12-23 08:53:59 +08:00
|
|
|
// RUN: clang -fsyntax-only -verify -fblocks %s
|
|
|
|
@protocol NSObject;
|
|
|
|
|
|
|
|
void bar(id(^)(void));
|
|
|
|
void foo(id <NSObject>(^objectCreationBlock)(void)) {
|
|
|
|
return bar(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (^)(void)', expected 'id<NSObject> (^)(void)'}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void bar2(id(*)(void));
|
|
|
|
void foo2(id <NSObject>(*objectCreationBlock)(void)) {
|
|
|
|
return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (*)(void)', expected 'id<NSObject> (*)(void)'}}
|
|
|
|
}
|
|
|
|
|
2009-02-04 08:32:51 +08:00
|
|
|
void bar3(id(*)()); // expected-note{{candidate function}}
|
2008-12-23 08:53:59 +08:00
|
|
|
void foo3(id (*objectCreationBlock)(int)) {
|
2009-02-04 08:32:51 +08:00
|
|
|
return bar3(objectCreationBlock); // expected-error{{no matching}}
|
2008-12-23 08:53:59 +08:00
|
|
|
}
|
|
|
|
|
2009-02-04 08:32:51 +08:00
|
|
|
void bar4(id(^)()); // expected-note{{candidate function}}
|
2008-12-23 08:53:59 +08:00
|
|
|
void foo4(id (^objectCreationBlock)(int)) {
|
2009-02-04 08:32:51 +08:00
|
|
|
return bar4(objectCreationBlock); // expected-error{{no matching}}
|
2008-12-23 08:53:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void foo5(id (^x)(int)) {
|
|
|
|
if (x) { }
|
|
|
|
}
|