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