1 // RUN: clang-cc -ObjC -fsyntax-only %s -verify -fblocks
2 // FIXME: should compile
3 // Test for blocks with explicit return type specified.
9 - (id) some_method_that_returns_id;
14 void some_func (NSView * (^) (id));
16 typedef struct dispatch_item_s *dispatch_item_t;
17 typedef void (^completion_block_t)(void);
19 typedef double (^myblock)(int);
20 double test(myblock I);
27 (void)^void *{ return 0; };
29 (void)^float(float y){ return y; };
31 (void)^double (float y, double d)
39 const char * (^chb) (int flag, const char *arg, char *arg1) = ^ const char * (int flag, const char *arg, char *arg1) {
49 (void)^PF { return &gf; };
51 some_func(^ NSView * (id whatever) { return [some_object some_method_that_returns_id]; });
53 double res = test(^(int z){x = y+z; return (double)z; });
60 completion_block_t (^blockx)(dispatch_item_t) = ^completion_block_t (dispatch_item_t item) {
64 completion_block_t (^blocky)(dispatch_item_t) = ^(dispatch_item_t item) {
73 // intent: block taking int returning block that takes char,int and returns int
74 int (^(^block)(double x))(char, short);
78 block = ^(double x){ return ^(char c, short y) { return one + c + y; };}; // expected-error {{returning block that lives on the local stack}}
80 block = ^(double x){ return ^(char c, short y) { return one + (int)c + y; };}; // expected-error {{returning block that lives on the local stack}}