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