1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuctypedef unsigned int size_t; 4*f4a2713aSLionel Sambuc@protocol P @end 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc@interface NSMutableArray 7*f4a2713aSLionel Sambuc- (id)objectAtIndexedSubscript:(size_t)index; 8*f4a2713aSLionel Sambuc- (void)setObject:(id)object atIndexedSubscript:(size_t)index; 9*f4a2713aSLionel Sambuc@end 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc@interface NSMutableDictionary 12*f4a2713aSLionel Sambuc- (id)objectForKeyedSubscript:(id)key; 13*f4a2713aSLionel Sambuc- (void)setObject:(id)object forKeyedSubscript:(size_t)key; 14*f4a2713aSLionel Sambuc@end 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambucid func() { 17*f4a2713aSLionel Sambuc NSMutableArray *array; 18*f4a2713aSLionel Sambuc float f; 19*f4a2713aSLionel Sambuc array[f] = array; // expected-error {{indexing expression is invalid because subscript type 'float' is not an integral or Objective-C pointer type}} 20*f4a2713aSLionel Sambuc return array[3.14]; // expected-error {{indexing expression is invalid because subscript type 'double' is not an integral or Objective-C pointer type}} 21*f4a2713aSLionel Sambuc} 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambucvoid test_unused() { 24*f4a2713aSLionel Sambuc NSMutableArray *array; 25*f4a2713aSLionel Sambuc array[10]; // expected-warning {{container access result unused - container access should not be used for side effects}} 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc NSMutableDictionary *dict; 28*f4a2713aSLionel Sambuc dict[array]; // expected-warning {{container access result unused - container access should not be used for side effects}} 29*f4a2713aSLionel Sambuc} 30*f4a2713aSLionel Sambuc 31