From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Parser/block-pointer-decl.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 clang/test/Parser/block-pointer-decl.c (limited to 'clang/test/Parser/block-pointer-decl.c') diff --git a/clang/test/Parser/block-pointer-decl.c b/clang/test/Parser/block-pointer-decl.c new file mode 100644 index 0000000..a8cc258 --- /dev/null +++ b/clang/test/Parser/block-pointer-decl.c @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s + +int printf(char const *, ...); + +struct blockStruct { + int (^a)(float, int); + int b; +}; + +int blockTaker (int (^myBlock)(int), int other_input) +{ + return 5 * myBlock (other_input); +} + +int main (int argc, char **argv) +{ + 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)); + return 0; +} + -- cgit v1.2.3