1// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks 2 3@class NSObject; 4typedef void (^block1_t)(int arg); 5typedef void (^block2_t)(block1_t arg); 6typedef void (^block3_t)(NSObject *arg); 7typedef void (^block4_t)(id arg); 8 9void fn(block4_t arg); // expected-note {{passing argument to parameter 'arg' here}} 10 11void another_fn(block2_t arg); 12 13int main(void) { 14 block1_t b1; 15 block2_t b2; 16 block3_t b3; 17 block3_t b4; 18 block4_t b5; 19 20 fn(b1); // expected-error {{incompatible block pointer types passing 'block1_t' (aka 'void (^)(int)') to parameter of type 'block4_t' (aka 'void (^)(id)')}} 21 fn(b2); // must succeed: block1_t *is* compatible with id 22 fn(b3); // succeeds: NSObject* compatible with id 23 fn(b4); // succeeds: id compatible with id 24 25 another_fn(b5); 26} 27