2010-07-26 12:08:02 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
|
2012-10-19 20:44:48 +08:00
|
|
|
// expected-no-diagnostics
|
2010-07-26 12:08:02 +08:00
|
|
|
|
|
|
|
int printf(char const *, ...);
|
2008-08-28 00:04:49 +08:00
|
|
|
|
|
|
|
struct blockStruct {
|
|
|
|
int (^a)(float, int);
|
|
|
|
int b;
|
|
|
|
};
|
|
|
|
|
|
|
|
int blockTaker (int (^myBlock)(int), int other_input)
|
|
|
|
{
|
2008-08-29 03:20:44 +08:00
|
|
|
return 5 * myBlock (other_input);
|
2008-08-28 00:04:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int main (int argc, char **argv)
|
|
|
|
{
|
2008-08-29 03:20:44 +08:00
|
|
|
int (^blockptr) (int) = ^(int inval) {
|
|
|
|
printf ("Inputs: %d, %d.\n", argc, inval);
|
|
|
|
return argc * inval;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
argc = 10;
|
|
|
|
printf ("I got: %d.\n",
|
|
|
|
blockTaker (blockptr, 6));
|
2008-08-28 00:04:49 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|