Fariborz Jahanian | 7965172 | 2010-06-02 21:35:17 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fblocks %s -emit-llvm -o %t |
| 2 | // rdar: // 8041962 |
| 3 | |
| 4 | extern "C" int printf(const char*, ...); |
| 5 | |
| 6 | struct ST { |
| 7 | int filler; |
| 8 | int referrer; |
| 9 | }; |
| 10 | |
| 11 | void OUTER_BLOCK(void (^fixer)(ST& ref)) { |
| 12 | ST ref = {2, 100}; |
| 13 | fixer(ref); |
| 14 | } |
| 15 | |
| 16 | void INNER_BLOCK(int (^largeDo) ()) { |
| 17 | printf("%d\n", largeDo()); |
| 18 | } |
| 19 | |
| 20 | void scan() { |
| 21 | OUTER_BLOCK(^(ST &ref) { |
| 22 | INNER_BLOCK(^() { return ref.referrer + ref.filler; }); |
| 23 | }); |
| 24 | |
| 25 | } |
| 26 | |
| 27 | int main() { |
| 28 | scan(); |
| 29 | } |