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