xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/objc-container-subscripting-attr.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
2*0a6a1f1dSLionel Sambuc// rdar://16842487
3*0a6a1f1dSLionel Sambuc// pr19682
4*0a6a1f1dSLionel Sambuc
5*0a6a1f1dSLionel Sambuc@interface Subscriptable
6*0a6a1f1dSLionel Sambuc- (id)objectForKeyedSubscript:(id)sub __attribute__((unavailable)); // expected-note 2 {{'objectForKeyedSubscript:' has been explicitly marked unavailable here}}
7*0a6a1f1dSLionel Sambuc- (void)setObject:(id)object forKeyedSubscript:(id)key __attribute__((unavailable)); // expected-note {{'setObject:forKeyedSubscript:' has been explicitly marked unavailable here}}
8*0a6a1f1dSLionel Sambuc@end
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambucid test(Subscriptable *obj) {
11*0a6a1f1dSLionel Sambuc  obj[obj] = obj;  // expected-error {{'setObject:forKeyedSubscript:' is unavailable}}
12*0a6a1f1dSLionel Sambuc  return obj[obj]; // expected-error {{'objectForKeyedSubscript:' is unavailable}}
13*0a6a1f1dSLionel Sambuc}
14*0a6a1f1dSLionel Sambuc
15*0a6a1f1dSLionel Sambucid control(Subscriptable *obj) {
16*0a6a1f1dSLionel Sambuc  return [obj objectForKeyedSubscript:obj]; // expected-error {{'objectForKeyedSubscript:' is unavailable}}
17*0a6a1f1dSLionel Sambuc}
18*0a6a1f1dSLionel Sambuc
19