Fariborz Jahanian | 5e49b2f | 2010-02-24 22:48:18 +0000 | [diff] [blame] | 1 | // 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 | |
| 6 | void 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 Jahanian | 2ce692a | 2010-02-24 22:53:58 +0000 | [diff] [blame] | 27 | struct S { |
| 28 | int y; |
| 29 | }; |
| 30 | |
| 31 | void foo () { |
| 32 | struct S *SELF; |
| 33 | f(^{ |
| 34 | f(^{ |
| 35 | SELF->y = 42; |
| 36 | }); |
| 37 | }); |
| 38 | } |
Fariborz Jahanian | e7c5c93 | 2010-02-26 19:05:20 +0000 | [diff] [blame^] | 39 | |
| 40 | // radar 7692419 |
| 41 | @interface Bar |
| 42 | @end |
| 43 | |
| 44 | void f(Bar *); |
| 45 | void q(void (^block)(void)); |
| 46 | |
| 47 | void 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 | } |