Fariborz Jahanian | 9e0393d | 2012-02-04 19:06:06 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-fragile-abi %s -o %t-rw.cpp |
Fariborz Jahanian | 5e49b2f | 2010-02-24 22:48:18 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
Fariborz Jahanian | 43aa1c3 | 2012-04-16 22:14:01 +0000 | [diff] [blame^] | 3 | // 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 Jahanian | 5e49b2f | 2010-02-24 22:48:18 +0000 | [diff] [blame] | 5 | // radar 7682149 |
| 6 | |
| 7 | |
| 8 | void 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 Jahanian | 2ce692a | 2010-02-24 22:53:58 +0000 | [diff] [blame] | 29 | struct S { |
| 30 | int y; |
| 31 | }; |
| 32 | |
| 33 | void foo () { |
| 34 | struct S *SELF; |
| 35 | f(^{ |
| 36 | f(^{ |
| 37 | SELF->y = 42; |
| 38 | }); |
| 39 | }); |
| 40 | } |
Fariborz Jahanian | e7c5c93 | 2010-02-26 19:05:20 +0000 | [diff] [blame] | 41 | |
| 42 | // radar 7692419 |
| 43 | @interface Bar |
| 44 | @end |
| 45 | |
| 46 | void f(Bar *); |
| 47 | void q(void (^block)(void)); |
| 48 | |
| 49 | void 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 | } |