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