1*67e74705SXin Li// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2*67e74705SXin Li 3*67e74705SXin Li@interface foo 4*67e74705SXin Li@end 5*67e74705SXin Li 6*67e74705SXin Li@implementation foo 7*67e74705SXin Li@end 8*67e74705SXin Li 9*67e74705SXin Li@interface bar 10*67e74705SXin Li-(void) my_method:(foo) my_param; // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}} 11*67e74705SXin Li- (foo)cccccc:(long)ddddd; // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}} 12*67e74705SXin Li@end 13*67e74705SXin Li 14*67e74705SXin Li@implementation bar 15*67e74705SXin Li-(void) my_method:(foo) my_param // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}} 16*67e74705SXin Li{ 17*67e74705SXin Li} 18*67e74705SXin Li- (foo)cccccc:(long)ddddd // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}} 19*67e74705SXin Li{ 20*67e74705SXin Li} 21*67e74705SXin Li@end 22*67e74705SXin Li 23*67e74705SXin Livoid somefunc(foo x) {} // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}} 24*67e74705SXin Lifoo somefunc2() {} // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}} 25*67e74705SXin Li 26*67e74705SXin Li// rdar://6780761 27*67e74705SXin Livoid f0(foo *a0) { 28*67e74705SXin Li extern void g0(int x, ...); 29*67e74705SXin Li g0(1, *(foo*)a0); // expected-error {{cannot pass object with interface type 'foo' by value through variadic function}} 30*67e74705SXin Li} 31*67e74705SXin Li 32*67e74705SXin Li// rdar://8421082 33*67e74705SXin Lienum bogus; // expected-note {{forward declaration of 'enum bogus'}} 34*67e74705SXin Li 35*67e74705SXin Li@interface fee { 36*67e74705SXin Li} 37*67e74705SXin Li- (void)crashMe:(enum bogus)p; 38*67e74705SXin Li@end 39*67e74705SXin Li 40*67e74705SXin Li@implementation fee 41*67e74705SXin Li- (void)crashMe:(enum bogus)p { // expected-error {{variable has incomplete type 'enum bogus'}} 42*67e74705SXin Li} 43*67e74705SXin Li@end 44*67e74705SXin Li 45*67e74705SXin Li@interface arrayfun 46*67e74705SXin Li- (int[6])arrayRet; // expected-error {{function cannot return array type 'int [6]'}} 47*67e74705SXin Li- (int())funcRet; // expected-error {{function cannot return function type 'int ()'}} 48*67e74705SXin Li@end 49*67e74705SXin Li 50*67e74705SXin Li@interface qux 51*67e74705SXin Li- (void) my_method: (int)arg; // expected-note {{method 'my_method:' declared here}} 52*67e74705SXin Li@end 53*67e74705SXin Li 54*67e74705SXin Li// FIXME: The diagnostic and recovery here could probably be improved. 55*67e74705SXin Li@implementation qux // expected-warning {{method definition for 'my_method:' not found}} 56*67e74705SXin Li- (void) my_method: (int) { // expected-error {{expected identifier}} 57*67e74705SXin Li} 58*67e74705SXin Li@end 59