Dale Johannesen | fd8c4d9 | 2009-01-26 23:22:19 +0000 | [diff] [blame] | 1 | // RUN: %llvmgcc -x objective-c -S %s -fobjc-gc -o - | grep objc_assign_strongCast |
| 2 | // rdar://5541393 |
| 3 | |
| 4 | typedef struct { |
| 5 | void (^ivarBlock)(void); |
| 6 | } StructWithBlock_t; |
| 7 | |
| 8 | int 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 | } |