| 1 |
// 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 |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
| 3 |
|
| 4 |
extern "C" int printf(const char*, ...); |
| 5 |
|
| 6 |
void bar(void (^block)()) { |
| 7 |
block(); |
| 8 |
} |
| 9 |
|
| 10 |
int main() { |
| 11 |
static int myArr[3] = {1, 2, 3}; |
| 12 |
printf ("%d %d %d\n", myArr[0], myArr[1], myArr[2]); |
| 13 |
|
| 14 |
bar(^{ |
| 15 |
printf ("%d %d %d\n", myArr[0], myArr[1], myArr[2]); |
| 16 |
myArr[0] = 42; |
| 17 |
myArr[2] = 100; |
| 18 |
printf ("%d %d %d\n", myArr[0], myArr[1], myArr[2]); |
| 19 |
}); |
| 20 |
|
| 21 |
printf ("%d %d %d\n", myArr[0], myArr[1], myArr[2]); |
| 22 |
} |