blob: 32833a81e1695988b6e4285468d712813672e4fe [file] [log] [blame]
Dale Johannesenfd8c4d92009-01-26 23:22:19 +00001// RUN: %llvmgcc -x objective-c -S %s -fobjc-gc -o - | grep objc_assign_strongCast
2// rdar://5541393
3
4typedef struct {
5 void (^ivarBlock)(void);
6} StructWithBlock_t;
7
8int main(char *argc, char *argv[]) {
9 StructWithBlock_t *swbp = (StructWithBlock_t *)malloc(sizeof(StructWithBlock_t*));
10 __block int i = 10;
11 // assigning a Block into an struct slot should elicit a write-barrier under GC
12 swbp->ivarBlock = ^ { ++i; };
13 return 0;
14}