Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | 9bae5e7 | 2009-01-17 21:57:49 +0000 | [diff] [blame] | 2 | |
| 3 | @interface foo |
| 4 | @end |
| 5 | |
| 6 | @implementation foo |
| 7 | @end |
| 8 | |
| 9 | @interface bar |
Chris Lattner | 2dd979f | 2009-04-11 19:08:56 +0000 | [diff] [blame] | 10 | -(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 Jahanian | 9bae5e7 | 2009-01-17 21:57:49 +0000 | [diff] [blame] | 12 | @end |
| 13 | |
| 14 | @implementation bar |
Chris Lattner | 2dd979f | 2009-04-11 19:08:56 +0000 | [diff] [blame] | 15 | -(void) my_method:(foo) my_param // expected-error {{Objective-C interface type 'foo' cannot be passed by value}} |
Steve Naroff | ccef371 | 2009-02-20 22:59:16 +0000 | [diff] [blame] | 16 | { |
| 17 | } |
Chris Lattner | 2dd979f | 2009-04-11 19:08:56 +0000 | [diff] [blame] | 18 | - (foo)cccccc:(long)ddddd // expected-error {{Objective-C interface type 'foo' cannot be returned by value}} |
Fariborz Jahanian | 9bae5e7 | 2009-01-17 21:57:49 +0000 | [diff] [blame] | 19 | { |
| 20 | } |
| 21 | @end |
| 22 | |
Chris Lattner | 2dd979f | 2009-04-11 19:08:56 +0000 | [diff] [blame] | 23 | void somefunc(foo x) {} // expected-error {{Objective-C interface type 'foo' cannot be passed by value}} |
Chris Lattner | bb74982 | 2009-04-11 19:17:25 +0000 | [diff] [blame] | 24 | foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot be returned by value}} |
Chris Lattner | 312531a | 2009-04-12 08:11:20 +0000 | [diff] [blame] | 25 | |
| 26 | // rdar://6780761 |
| 27 | void 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 | } |