brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 48c5f5c Raw
51 lines · plain
1// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s2 3typedef unsigned int size_t;4@protocol P @end5@protocol NSCopying @end6 7@interface NSMutableArray8- (id)objectAtIndexedSubscript:(size_t)index;9- (void)setObject:(id)object atIndexedSubscript:(size_t)index;10@end11 12struct S {13  operator unsigned int ();14  operator id ();15};16 17@interface NSMutableDictionary18- (id)objectForKeyedSubscript:(id<NSCopying>)key;19- (void)setObject:(id)object forKeyedSubscript:(id<NSCopying>)key;20@end21 22int main() {23  NSMutableArray<P> * array;24  S s;25  id oldObject = array[(int)s];26 27  NSMutableDictionary<P> *dict;28  dict[(id)s] = oldObject;29  oldObject = dict[(id)s];30 31}32 33template <class T> void test2(NSMutableArray *a) {34  a[10] = 0;35}36template void test2<int>(NSMutableArray*);37// CHECK-LABEL: define weak_odr void @_Z5test2IiEvP14NSMutableArray38// CHECK: @objc_msgSend 39// CHECK: ret void40 41 42template <class T> void test3(NSMutableArray *a) {43  a[sizeof(T)] = 0;44}45 46template void test3<int>(NSMutableArray*);47// CHECK-LABEL: define weak_odr void @_Z5test3IiEvP14NSMutableArray48// CHECK: @objc_msgSend49// CHECK: ret void50 51