summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-06-10 19:02:48 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-06-10 19:02:48 +0000
commit3d5764091d69f287dafd90a95a901a2829ea9d10 (patch)
treeaf06f421f75afc91edab66e8793b94afaf73ae24 /clang/test
parent6e43965fbc0dd7c7b0cdc72ae6138d51426d610d (diff)
downloadbcm5719-llvm-3d5764091d69f287dafd90a95a901a2829ea9d10.tar.gz
bcm5719-llvm-3d5764091d69f287dafd90a95a901a2829ea9d10.zip
Objective-C. Don't ignore availability attribute when
doing Objective-C subscript access. // rdar://16842487 PR19682. llvm-svn: 210565
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjC/objc-container-subscripting-attr.m18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/objc-container-subscripting-attr.m b/clang/test/SemaObjC/objc-container-subscripting-attr.m
new file mode 100644
index 00000000000..17110c47576
--- /dev/null
+++ b/clang/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