blob: 0a1b1cd06782c7605256d1b0aa1fac3483fba822 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Fariborz Jahanian9bae5e72009-01-17 21:57:49 +00002
3@interface foo
4@end
5
6@implementation foo
7@end
8
9@interface bar
Fariborz Jahaniane9f55812010-04-07 00:22:00 +000010-(void) my_method:(foo) my_param; // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
11- (foo)cccccc:(long)ddddd; // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
Fariborz Jahanian9bae5e72009-01-17 21:57:49 +000012@end
13
14@implementation bar
Fariborz Jahaniane9f55812010-04-07 00:22:00 +000015-(void) my_method:(foo) my_param // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
Steve Naroffccef3712009-02-20 22:59:16 +000016{
17}
Fariborz Jahaniane9f55812010-04-07 00:22:00 +000018- (foo)cccccc:(long)ddddd // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
Fariborz Jahanian9bae5e72009-01-17 21:57:49 +000019{
20}
21@end
22
Fariborz Jahaniane9f55812010-04-07 00:22:00 +000023void somefunc(foo x) {} // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
24foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
Chris Lattner312531a2009-04-12 08:11:20 +000025
26// rdar://6780761
27void f0(foo *a0) {
28 extern void g0(int x, ...);
Argyrios Kyrtzidis8a285ae2011-04-26 17:41:22 +000029 g0(1, *(foo*)a0); // expected-error {{cannot pass object with interface type 'foo' by-value through variadic function}}
Chris Lattner312531a2009-04-12 08:11:20 +000030}
Fariborz Jahanian23c01042010-09-17 22:07:07 +000031
32// rdar://8421082
33enum 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