• 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
23// Ensure that this function is properly marked as a failure.
24void 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
29void somefunc(foo x) {} // expected-error {{interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
30foo somefunc2() {} // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
31
32// rdar://6780761
33void f0(foo *a0) {
34  extern void g0(int x, ...);
35  g0(1, *(foo*)a0);  // expected-error {{cannot pass object with interface type 'foo' by value through variadic function}}
36}
37
38// rdar://8421082
39enum bogus; // expected-note {{forward declaration of 'enum bogus'}}
40
41@interface fee  {
42}
43- (void)crashMe:(enum bogus)p;
44@end
45
46@implementation fee
47- (void)crashMe:(enum bogus)p { // expected-error {{variable has incomplete type 'enum bogus'}}
48}
49@end
50
51@interface arrayfun
52- (int[6])arrayRet; // expected-error {{function cannot return array type 'int [6]'}}
53- (int())funcRet; // expected-error {{function cannot return function type 'int ()'}}
54@end
55
56@interface qux
57- (void) my_method: (int)arg; // expected-note {{method 'my_method:' declared here}}
58@end
59
60// FIXME: The diagnostic and recovery here could probably be improved.
61@implementation qux // expected-warning {{method definition for 'my_method:' not found}}
62- (void) my_method: (int) { // expected-error {{expected identifier}}
63}
64@end
65