1// 2// The LLVM Compiler Infrastructure 3// 4// This file is distributed under the University of Illinois Open Source 5// License. See LICENSE.TXT for details. 6 7// 8// byrefaccess.m 9// test that byref access to locals is accurate 10// testObjects 11// 12// Created by Blaine Garst on 5/13/08. 13// 14// CONFIG 15 16#include <stdio.h> 17 18 19void callVoidVoid(void (^closure)(void)) { 20 closure(); 21} 22 23int main(int argc, char *argv[]) { 24 __block int i = 10; 25 26 callVoidVoid(^{ ++i; }); 27 28 if (i != 11) { 29 printf("*** %s didn't update i\n", argv[0]); 30 return 1; 31 } 32 printf("%s: success\n", argv[0]); 33 return 0; 34} 35