summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjCXX
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-09-28 20:22:05 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-09-28 20:22:05 +0000
commit600ba208abad989710ff3ad7cbe3ab0a9f77ed06 (patch)
treea243afa564e4b0b88ed2f22c1eb21dcaf0ab8e0a /clang/test/SemaObjCXX
parent094d8e3b56e1e6ce1f0fdbccfc8ac1464e5095c7 (diff)
downloadbcm5719-llvm-600ba208abad989710ff3ad7cbe3ab0a9f77ed06.tar.gz
bcm5719-llvm-600ba208abad989710ff3ad7cbe3ab0a9f77ed06.zip
objc++ arc: Diagnose block pointer type mismatch when
some arguments types are ns_consumed and some otherwise matching types are not. This fixes the objc++ side only *auch*. // rdar://10187884 llvm-svn: 140717
Diffstat (limited to 'clang/test/SemaObjCXX')
-rw-r--r--clang/test/SemaObjCXX/arc-nsconsumed-errors.mm20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaObjCXX/arc-nsconsumed-errors.mm b/clang/test/SemaObjCXX/arc-nsconsumed-errors.mm
new file mode 100644
index 00000000000..d1d4531c27d
--- /dev/null
+++ b/clang/test/SemaObjCXX/arc-nsconsumed-errors.mm
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
+// rdar://10187884
+
+typedef void (^blk)(id, __attribute((ns_consumed)) id);
+typedef void (^blk1)(__attribute((ns_consumed))id, __attribute((ns_consumed)) id);
+blk a = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk'}}
+
+blk b = ^void (id, __attribute((ns_consumed)) id){};
+
+blk c = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk'}}
+
+blk d = ^void (id, id) {}; // expected-error {{cannot initialize a variable of type '__strong blk'}}
+
+blk1 a1 = ^void (__attribute((ns_consumed)) id, id){}; // expected-error {{cannot initialize a variable of type '__strong blk1'}}
+
+blk1 b2 = ^void (id, __attribute((ns_consumed)) id){}; // expected-error {{cannot initialize a variable of type '__strong blk1'}}
+
+blk1 c3 = ^void (__attribute((ns_consumed)) id, __attribute((ns_consumed)) id){};
+
+blk1 d4 = ^void (id, id) {}; // expected-error {{cannot initialize a variable of type '__strong blk1'}}
OpenPOWER on IntegriCloud