Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -parse-noop -fblocks %s |
Steve Naroff | 5618bd4 | 2008-08-27 16:04:49 +0000 | [diff] [blame] | 2 | |
| 3 | struct blockStruct { |
| 4 | int (^a)(float, int); |
| 5 | int b; |
| 6 | }; |
| 7 | |
| 8 | int blockTaker (int (^myBlock)(int), int other_input) |
| 9 | { |
Steve Naroff | 296e8d5 | 2008-08-28 19:20:44 +0000 | [diff] [blame] | 10 | return 5 * myBlock (other_input); |
Steve Naroff | 5618bd4 | 2008-08-27 16:04:49 +0000 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | int main (int argc, char **argv) |
| 14 | { |
Steve Naroff | 296e8d5 | 2008-08-28 19:20:44 +0000 | [diff] [blame] | 15 | int (^blockptr) (int) = ^(int inval) { |
| 16 | printf ("Inputs: %d, %d.\n", argc, inval); |
| 17 | return argc * inval; |
| 18 | }; |
| 19 | |
| 20 | |
| 21 | argc = 10; |
| 22 | printf ("I got: %d.\n", |
| 23 | blockTaker (blockptr, 6)); |
Steve Naroff | 5618bd4 | 2008-08-27 16:04:49 +0000 | [diff] [blame] | 24 | return 0; |
| 25 | } |
| 26 | |