From 3d5764091d69f287dafd90a95a901a2829ea9d10 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 10 Jun 2014 19:02:48 +0000 Subject: Objective-C. Don't ignore availability attribute when doing Objective-C subscript access. // rdar://16842487 PR19682. llvm-svn: 210565 --- clang/test/SemaObjC/objc-container-subscripting-attr.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 clang/test/SemaObjC/objc-container-subscripting-attr.m (limited to 'clang/test/SemaObjC/objc-container-subscripting-attr.m') 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}} +} + -- cgit v1.2.3