summaryrefslogtreecommitdiffstats
path: root/test/SemaObjC/objc-container-subscripting-attr.m
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
committerdim <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
commit173a4f43a911175643bda81ee675e8d9269056ea (patch)
tree47df2c12b57214af6c31e47404b005675b8b7ffc /test/SemaObjC/objc-container-subscripting-attr.m
parent88f7a7d5251a2d813460274c92decc143a11569b (diff)
downloadFreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.zip
FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.tar.gz
Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_350/final@216957
Diffstat (limited to 'test/SemaObjC/objc-container-subscripting-attr.m')
-rw-r--r--test/SemaObjC/objc-container-subscripting-attr.m18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaObjC/objc-container-subscripting-attr.m b/test/SemaObjC/objc-container-subscripting-attr.m
new file mode 100644
index 0000000..17110c4
--- /dev/null
+++ b/test/SemaObjC/objc-container-subscripting-attr.m
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// rdar://16842487
+// pr19682
+
+@interface Subscriptable
+- (id)objectForKeyedSubscript:(id)sub __attribute__((unavailable)); // expected-note 2 {{'objectForKeyedSubscript:' has been explicitly marked unavailable here}}
+- (void)setObject:(id)object forKeyedSubscript:(id)key __attribute__((unavailable)); // expected-note {{'setObject:forKeyedSubscript:' has been explicitly marked unavailable here}}
+@end
+
+id test(Subscriptable *obj) {
+ obj[obj] = obj; // expected-error {{'setObject:forKeyedSubscript:' is unavailable}}
+ return obj[obj]; // expected-error {{'objectForKeyedSubscript:' is unavailable}}
+}
+
+id control(Subscriptable *obj) {
+ return [obj objectForKeyedSubscript:obj]; // expected-error {{'objectForKeyedSubscript:' is unavailable}}
+}
+
OpenPOWER on IntegriCloud