blob: d88daf3a870dd8d5df0d6c64bf9b9f81236a4039 [file] [log] [blame]
Douglas Gregor87c30072010-07-26 04:08:02 +00001// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00002// expected-no-diagnostics
Douglas Gregor87c30072010-07-26 04:08:02 +00003
4int printf(char const *, ...);
Steve Naroff5618bd42008-08-27 16:04:49 +00005
6struct blockStruct {
7 int (^a)(float, int);
8 int b;
9};
10
11int blockTaker (int (^myBlock)(int), int other_input)
12{
Steve Naroff296e8d52008-08-28 19:20:44 +000013 return 5 * myBlock (other_input);
Steve Naroff5618bd42008-08-27 16:04:49 +000014}
15
16int main (int argc, char **argv)
17{
Steve Naroff296e8d52008-08-28 19:20:44 +000018 int (^blockptr) (int) = ^(int inval) {
19 printf ("Inputs: %d, %d.\n", argc, inval);
20 return argc * inval;
21 };
22
23
24 argc = 10;
25 printf ("I got: %d.\n",
26 blockTaker (blockptr, 6));
Steve Naroff5618bd42008-08-27 16:04:49 +000027 return 0;
28}
29