• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
23void 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'}}
25
26// rdar://6780761
27void f0(foo *a0) {
28  extern void g0(int x, ...);
29  g0(1, *(foo*)a0);  // expected-error {{cannot pass object with interface type 'foo' by value through variadic function}}
30}
31
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
45@interface arrayfun
46- (int[6])arrayRet; // expected-error {{function cannot return array type 'int [6]'}}
47- (int())funcRet; // expected-error {{function cannot return function type 'int ()'}}
48@end
49
50@interface qux
51- (void) my_method: (int)arg; // expected-note {{method 'my_method:' declared here}}
52@end
53
54// FIXME: The diagnostic and recovery here could probably be improved.
55@implementation qux // expected-warning {{method definition for 'my_method:' not found}}
56- (void) my_method: (int) { // expected-error {{expected identifier}}
57}
58@end
59