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//  nullblockisa.m
9//  testObjects
10//
11//  Created by Blaine Garst on 9/24/08.
12//
13// CONFIG rdar://6244520
14
15
16
17#include <stdio.h>
18#include <stdlib.h>
19#include <Block_private.h>
20
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        printf("not a NULL __block isa\n");
30        exit(1);
31    }
32    return;
33}
34
35int main(int argc, char *argv[]) {
36
37   __block int i;
38
39   check(^{ printf("%d\n", ++i); });
40   printf("%s: success\n", argv[0]);
41   return 0;
42}
43
44