blob: 1a6bcdde61768f1e68adb06e91290d5f74b8f97a [file] [log] [blame]
Fariborz Jahanian5e49b2f2010-02-24 22:48:18 +00001// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
2// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3// radar 7682149
4
5
6void f(void (^block)(void));
7
8@interface X {
9 int y;
10}
11- (void)foo;
12@end
13
14@implementation X
15- (void)foo {
16 f(^{
17 f(^{
18 f(^{
19 y=42;
20 });
21 });
22});
23
24}
25@end
26
Fariborz Jahanian2ce692a2010-02-24 22:53:58 +000027struct S {
28 int y;
29};
30
31void foo () {
32 struct S *SELF;
33 f(^{
34 f(^{
35 SELF->y = 42;
36 });
37 });
38}
Fariborz Jahaniane7c5c932010-02-26 19:05:20 +000039
40// radar 7692419
41@interface Bar
42@end
43
44void f(Bar *);
45void q(void (^block)(void));
46
47void x() {
48 void (^myblock)(Bar *b) = ^(Bar *b) {
49 q(^{
50 f(b);
51 });
52 };
53
54 Bar *b = (Bar *)42;
55 myblock(b);
56}