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