Home | History | Annotate | Download | only in SemaObjCXX
      1 // RUN: %clang_cc1 -verify -emit-llvm -o - %s
      2 
      3 // Test reference binding.
      4 
      5 typedef 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 
     15 int f0(const T& t) {
     16   return t.f0;
     17 }
     18 
     19 int f1(A *a) {
     20   return f0(a.p0);
     21 }
     22 
     23 int f2(A *a) {
     24   return f0(a.p1);	
     25 }
     26 
     27 // PR7740
     28 @class NSString;
     29 
     30 void f3(id);
     31 void 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
     41 typedef bar baz;
     42 
     43 struct ToBar {
     44   operator bar&() const;
     45 };
     46 
     47 void f5(foo&);
     48 void f5b(foo<P1>&);
     49 void f5c(foo<P2>&);
     50 void f5d(foo<P3>&);
     51 void 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