Home | History | Annotate | Download | only in SemaObjC
      1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
      2 
      3 @interface foo
      4 @end
      5 
      6 @implementation foo
      7 @end
      8 
      9 @interface bar
     10 -(void) my_method:(foo) my_param; // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
     11 - (foo)cccccc:(long)ddddd;  // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
     12 @end
     13 
     14 @implementation bar
     15 -(void) my_method:(foo) my_param  // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
     16 {
     17 }
     18 - (foo)cccccc:(long)ddddd // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
     19 {
     20 }
     21 @end
     22 
     23 void somefunc(foo x) {} // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
     24 foo somefunc2() {} // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
     25 
     26 // rdar://6780761
     27 void f0(foo *a0) {
     28   extern void g0(int x, ...);
     29   g0(1, *(foo*)a0);  // expected-error {{cannot pass object with interface type 'foo' by value through variadic function}}
     30 }
     31 
     32 // rdar://8421082
     33 enum bogus; // expected-note {{forward declaration of 'enum bogus'}}
     34 
     35 @interface fee  {
     36 }
     37 - (void)crashMe:(enum bogus)p;
     38 @end
     39 
     40 @implementation fee
     41 - (void)crashMe:(enum bogus)p { // expected-error {{variable has incomplete type 'enum bogus'}}
     42 }
     43 @end
     44 
     45