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