Blaine Garst | 86d0ba4 | 2010-08-04 23:34:21 +0000 | [diff] [blame] | 1 | // |
| 2 | // The LLVM Compiler Infrastructure |
| 3 | // |
| 4 | // This file is distributed under the University of Illinois Open Source |
| 5 | // License. See LICENSE.TXT for details. |
| 6 | |
| 7 | /* |
| 8 | * cast.c |
| 9 | * testObjects |
| 10 | * |
| 11 | * Created by Blaine Garst on 2/17/09. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | // PURPOSE should allow casting of a Block reference to an arbitrary pointer and back |
| 16 | // CONFIG open |
| 17 | |
| 18 | #include <stdio.h> |
| 19 | |
| 20 | |
| 21 | |
| 22 | int main(int argc, char *argv[]) { |
| 23 | |
| 24 | void (^aBlock)(void); |
| 25 | int *ip; |
| 26 | char *cp; |
| 27 | double *dp; |
| 28 | |
| 29 | ip = (int *)aBlock; |
| 30 | cp = (char *)aBlock; |
| 31 | dp = (double *)aBlock; |
| 32 | aBlock = (void (^)(void))ip; |
| 33 | aBlock = (void (^)(void))cp; |
| 34 | aBlock = (void (^)(void))dp; |
| 35 | printf("%s: success", argv[0]); |
| 36 | return 0; |
| 37 | } |