1// 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} 20