blob: 324ed342f9188a611be0b4ec53b78c1c1499f0e1 [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, ...);
29 g0(1, *(foo*)0); // expected-error {{cannot pass object with interface type 'foo' by-value through variadic function}}
30}