blob: c1509bf9f6f21884190363b19ffd3ee199700769 [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
Chris Lattner2dd979f2009-04-11 19:08:56 +000010-(void) my_method:(foo) my_param; // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
11- (foo)cccccc:(long)ddddd; // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
Fariborz Jahanian9bae5e72009-01-17 21:57:49 +000012@end
13
14@implementation bar
Chris Lattner2dd979f2009-04-11 19:08:56 +000015-(void) my_method:(foo) my_param // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
Steve Naroffccef3712009-02-20 22:59:16 +000016{
17}
Chris Lattner2dd979f2009-04-11 19:08:56 +000018- (foo)cccccc:(long)ddddd // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
Fariborz Jahanian9bae5e72009-01-17 21:57:49 +000019{
20}
21@end
22
Chris Lattner2dd979f2009-04-11 19:08:56 +000023void somefunc(foo x) {} // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
Chris Lattnerbb749822009-04-11 19:17:25 +000024foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
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}