blob: d44b53614aa4aaff9a6874e61bab06c721bd78d7 [file] [log] [blame]
Patrick Beardb2f68202012-04-06 18:12:22 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
Fariborz Jahanian9bae5e72009-01-17 21:57:49 +00002
3@interface foo
4@end
5
6@implementation foo
7@end
8
9@interface bar
Richard Trieu2fe9b7f2011-12-15 00:38:15 +000010-(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'}}
Fariborz Jahanian9bae5e72009-01-17 21:57:49 +000012@end
13
14@implementation bar
Richard Trieu2fe9b7f2011-12-15 00:38:15 +000015-(void) my_method:(foo) my_param // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
Steve Naroffccef3712009-02-20 22:59:16 +000016{
17}
Richard Trieu2fe9b7f2011-12-15 00:38:15 +000018- (foo)cccccc:(long)ddddd // expected-error {{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
Richard Trieu2fe9b7f2011-12-15 00:38:15 +000023void somefunc(foo x) {} // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
24foo somefunc2() {} // expected-error {{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, ...);
Jordan Roseddcfbc92012-07-19 18:10:23 +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