1// RUN: %clang_cc1 -verify -emit-llvm -o - %s 2 3// Test reference binding. 4 5typedef struct { 6 int f0; 7 int f1; 8} T; 9 10@interface A 11@property (assign) T p0; 12@property (assign) T& p1; 13@end 14 15int f0(const T& t) { 16 return t.f0; 17} 18 19int f1(A *a) { 20 return f0(a.p0); 21} 22 23int f2(A *a) { 24 return f0(a.p1); 25} 26 27// PR7740 28@class NSString; 29 30void f3(id); 31void f4(NSString &tmpstr) { 32 f3(&tmpstr); 33} 34 35// PR7741 36@protocol P1 @end 37@protocol P2 @end 38@protocol P3 @end 39@interface foo<P1> {} @end 40@interface bar : foo <P1, P2, P3> {} @end 41typedef bar baz; 42 43struct ToBar { 44 operator bar&() const; 45}; 46 47void f5(foo&); 48void f5b(foo<P1>&); 49void f5c(foo<P2>&); 50void f5d(foo<P3>&); 51void f6(baz* x) { 52 f5(*x); 53 f5b(*x); 54 f5c(*x); 55 f5d(*x); 56 (void)((foo&)*x); 57 f5(ToBar()); 58 f5b(ToBar()); 59 f5c(ToBar()); 60 f5d(ToBar()); 61 (void)((foo&)ToBar()); 62} 63