1/* 2 * Copyright (c) 2010 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LLVM_LICENSE_HEADER@ 5 */ 6 7// 8// nullblockisa.m 9// testObjects 10// 11// Created by Blaine Garst on 9/24/08. 12// Copyright 2008 __MyCompanyName__. All rights reserved. 13// 14// TEST_CONFIG 15// rdar://6244520 16 17#include <stdio.h> 18#include <stdlib.h> 19#include <Block_private.h> 20#include "test.h" 21 22void check(void (^b)(void)) { 23 struct _custom { 24 struct Block_layout layout; 25 struct Block_byref *innerp; 26 } *custom = (struct _custom *)(void *)(b); 27 //printf("block is at %p, size is %lx, inner is %p\n", (void *)b, Block_size(b), innerp); 28 if (custom->innerp->isa != (void *)NULL) { 29 fail("not a NULL __block isa"); 30 } 31 return; 32} 33 34int main() { 35 36 __block int i; 37 38 check(^{ printf("%d\n", ++i); }); 39 40 succeed(__FILE__); 41} 42 43