1/* 2 * Copyright (c) 2010 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LLVM_LICENSE_HEADER@ 5 */ 6 7/* 8 * localisglobal.c 9 * testObjects 10 * 11 * Created by Blaine Garst on 9/29/08. 12 * Copyright 2008 __MyCompanyName__. All rights reserved. 13 */ 14 15// TEST_CONFIG 16// rdar://6230297 17 18#include <stdio.h> 19#include "test.h" 20 21void (^global)(void) = ^{ printf("hello world\n"); }; 22 23int aresame(void *first, void *second) { 24 long *f = (long *)first; 25 long *s = (long *)second; 26 return *f == *s; 27} 28int main() { 29 int i = 10; 30 void (^local)(void) = ^ { printf("hi %d\n", i); }; 31 void (^localisglobal)(void) = ^ { printf("hi\n"); }; 32 33 if (aresame(local, localisglobal)) { 34 fail("local block could be global, but isn't"); 35 } 36 if (!aresame(global, localisglobal)) { 37 fail("local block is not global, not stack, what is it??"); 38 } 39 40 succeed(__FILE__); 41} 42