summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/block-call.c2
-rw-r--r--clang/test/SemaObjC/blocks.m22
2 files changed, 23 insertions, 1 deletions
diff --git a/clang/test/Sema/block-call.c b/clang/test/Sema/block-call.c
index 66bf725922a..c52f0ed96bf 100644
--- a/clang/test/Sema/block-call.c
+++ b/clang/test/Sema/block-call.c
@@ -24,7 +24,7 @@ int main() {
int * (^IPCC2) () = IPCC; // expected-warning {{incompatible block pointer types initializing 'int *const (^)()', expected 'int *(^)()'}}
- int (^IPCC3) (const int) = PFR; // expected-warning {{incompatible block pointer types initializing 'int (^)(int)', expected 'int (^)(int const)'}}
+ int (^IPCC3) (const int) = PFR;
int (^IPCC4) (int, char (^CArg) (double));
diff --git a/clang/test/SemaObjC/blocks.m b/clang/test/SemaObjC/blocks.m
new file mode 100644
index 00000000000..dd8380aea92
--- /dev/null
+++ b/clang/test/SemaObjC/blocks.m
@@ -0,0 +1,22 @@
+// RUN: clang -fsyntax-only -verify -fblocks %s
+@protocol NSObject;
+
+void bar(id(^)(void));
+void foo(id <NSObject>(^objectCreationBlock)(void)) {
+ return bar(objectCreationBlock);
+}
+
+void bar2(id(*)(void));
+void foo2(id <NSObject>(*objectCreationBlock)(void)) {
+ return bar2(objectCreationBlock);
+}
+
+void bar3(id(*)());
+void foo3(id (*objectCreationBlock)(int)) {
+ return bar3(objectCreationBlock);
+}
+
+void bar4(id(^)());
+void foo4(id (^objectCreationBlock)(int)) {
+ return bar4(objectCreationBlock); // expected-warning{{incompatible block pointer types passing 'id (^)(int)', expected 'id (^)()'}}
+}
OpenPOWER on IntegriCloud