| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s |
| 2 |
|
| 3 |
@interface foo |
| 4 |
@end |
| 5 |
|
| 6 |
@implementation foo |
| 7 |
@end |
| 8 |
|
| 9 |
@interface bar |
| 10 |
-(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'}} |
| 12 |
@end |
| 13 |
|
| 14 |
@implementation bar |
| 15 |
-(void) my_method:(foo) my_param // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}} |
| 16 |
{ |
| 17 |
} |
| 18 |
- (foo)cccccc:(long)ddddd // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}} |
| 19 |
{ |
| 20 |
} |
| 21 |
@end |
| 22 |
|
| 23 |
// Ensure that this function is properly marked as a failure. |
| 24 |
void func_with_bad_call(bar* b, foo* f) { |
| 25 |
[b cccccc:5]; // expected-warning {{instance method '-cccccc:' not found}} |
| 26 |
// expected-note@-17 {{receiver is instance of class declared here}} |
| 27 |
} |
| 28 |
|
| 29 |
void somefunc(foo x) {} // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}} |
| 30 |
foo somefunc2(void) {} // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}} |
| 31 |
|
| 32 |
void f0(foo *a0) { |
| 33 |
extern void g0(int x, ...); |
| 34 |
g0(1, *(foo*)a0); // expected-error {{cannot pass object with interface type 'foo' by value through variadic function}} |
| 35 |
} |
| 36 |
|
| 37 |
enum bogus; // expected-note {{forward declaration of 'enum bogus'}} |
| 38 |
|
| 39 |
@interface fee { |
| 40 |
} |
| 41 |
- (void)crashMe:(enum bogus)p; |
| 42 |
@end |
| 43 |
|
| 44 |
@implementation fee |
| 45 |
- (void)crashMe:(enum bogus)p { // expected-error {{variable has incomplete type 'enum bogus'}} |
| 46 |
} |
| 47 |
@end |
| 48 |
|
| 49 |
@interface arrayfun |
| 50 |
- (int[6])arrayRet; // expected-error {{function cannot return array type 'int[6]'}} |
| 51 |
- (int(void))funcRet; // expected-error {{function cannot return function type 'int (void)'}} |
| 52 |
@end |
| 53 |
|
| 54 |
@interface qux |
| 55 |
- (void) my_method: (int)arg; // expected-note {{method 'my_method:' declared here}} |
| 56 |
@end |
| 57 |
|
| 58 |
// FIXME: The diagnostic and recovery here could probably be improved. |
| 59 |
@implementation qux // expected-warning {{method definition for 'my_method:' not found}} |
| 60 |
- (void) my_method: (int) { // expected-error {{expected identifier}} |
| 61 |
} |
| 62 |
@end |