Debian Codegraph @

clang/test/SemaObjC/objc-container-subscripting-attr.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2 // pr19682
3
4 @interface Subscriptable
5 - (id)objectForKeyedSubscript:(id)sub __attribute__((unavailable)); // expected-note 2 {{'objectForKeyedSubscript:' has been explicitly marked unavailable here}}
6 - (void)setObject:(id)object forKeyedSubscript:(id)key __attribute__((unavailable)); // expected-note {{'setObject:forKeyedSubscript:' has been explicitly marked unavailable here}}
7 @end
8
9 id test(Subscriptable *obj) {
10 obj[obj] = obj; // expected-error {{'setObject:forKeyedSubscript:' is unavailable}}
11 return obj[obj]; // expected-error {{'objectForKeyedSubscript:' is unavailable}}
12 }
13
14 id control(Subscriptable *obj) {
15 return [obj objectForKeyedSubscript:obj]; // expected-error {{'objectForKeyedSubscript:' is unavailable}}
16 }
17