summaryrefslogtreecommitdiff
path: root/test/FrontendObjC/2009-01-26-WriteBarrier-2.m
blob: 32833a81e1695988b6e4285468d712813672e4fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// RUN: %llvmgcc -x objective-c -S %s -fobjc-gc -o - | grep objc_assign_strongCast
// rdar://5541393

typedef struct {
    void (^ivarBlock)(void);
} StructWithBlock_t;

int main(char *argc, char *argv[]) {
   StructWithBlock_t *swbp = (StructWithBlock_t *)malloc(sizeof(StructWithBlock_t*));
   __block   int i = 10;
   // assigning a Block into an struct slot should elicit a write-barrier under GC
   swbp->ivarBlock = ^ { ++i; }; 
   return 0;
}