1 // RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks
3 void I( void (^)(void));
7 int printf(const char*, ...);
9 typedef void (^T
) (void);
12 int takeintint(int (^C
)(int)) { return C(4); }
14 T
somefunction(void) {
20 noop
= ^{printf("\nClosure\n"); };
24 return ^{printf("\nClosure\n"); };
29 takeblock(^{ printf("%d\n", x
); });
33 break; // expected-error {{'break' statement not in loop or switch statement}}
34 continue; // expected-error {{'continue' statement not in loop statement}}
36 goto foo
; // expected-error {{use of undeclared label 'foo'}}
43 takeblock(^{ x
= 4; }); // expected-error {{variable is not assignable (missing __block type specifier)}}
44 __block y
= 7; // expected-error {{type specifier missing, defaults to 'int'}}
45 takeblock(^{ y
= 8; });
49 void (^test3(void))(void) {
54 void (^noop
)(void) = ^{};
55 void (*noop2
)(void) = 0;
58 void myfunc(int (^block
)(int)) {}
60 void myfunc3(const int *x
);
73 void test_arguments(void) {
82 static int global_x
= 10;
83 void (^global_block
)(void) = ^{ printf("global x is %d\n", global_x
); };
85 typedef void (^void_block_t
)(void);
87 static const void_block_t myBlock
= ^{ };
89 static const void_block_t myBlock2
= ^ void(void) { };