blob: 16a9b31415a84d67a05fa7e85e28c9a2a682725b [file] [log] [blame]
John McCall260611a2012-06-20 06:18:46 +00001// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %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
Fariborz Jahanian8b08adb2012-05-03 21:44:12 +00008typedef unsigned long size_t;
Fariborz Jahanian5e49b2f2010-02-24 22:48:18 +00009void f(void (^block)(void));
10
11@interface X {
12 int y;
13}
14- (void)foo;
15@end
16
17@implementation X
18- (void)foo {
19 f(^{
20 f(^{
21 f(^{
22 y=42;
23 });
24 });
25});
26
27}
28@end
29
Fariborz Jahanian2ce692a2010-02-24 22:53:58 +000030struct S {
31 int y;
32};
33
34void foo () {
35 struct S *SELF;
36 f(^{
37 f(^{
38 SELF->y = 42;
39 });
40 });
41}
Fariborz Jahaniane7c5c932010-02-26 19:05:20 +000042
43// radar 7692419
44@interface Bar
45@end
46
47void f(Bar *);
48void q(void (^block)(void));
49
50void x() {
51 void (^myblock)(Bar *b) = ^(Bar *b) {
52 q(^{
53 f(b);
54 });
55 };
56
57 Bar *b = (Bar *)42;
58 myblock(b);
59}