blob: d7219f185ba7d07a573248b505d7ca43cc407620 [file] [log] [blame]
Eric Christophera1032cc2011-08-20 00:49:25 +00001// RUN: %clang_cc1 -fblocks -emit-llvm %s -fobjc-gc -o - | FileCheck %s
2
3// CHECK: objc_assign_strongCast
4// rdar://5541393
5
6typedef __SIZE_TYPE__ size_t;
7void * malloc(size_t size);
8
9typedef struct {
10 void (^ivarBlock)(void);
11} StructWithBlock_t;
12
13int main(int argc, char *argv[]) {
14 StructWithBlock_t *swbp = (StructWithBlock_t *)malloc(sizeof(StructWithBlock_t*));
15 __block int i = 10;
16 // assigning a Block into an struct slot should elicit a write-barrier under GC
17 swbp->ivarBlock = ^ { ++i; };
18 return 0;
19}