brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 5b56782 Raw
63 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s2 3@interface foo4@end5 6@implementation foo7@end8 9@interface bar10-(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@end13 14@implementation bar15-(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@end22 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(void) {} // expected-error {{interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}31 32void 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 37enum bogus; // expected-note {{forward declaration of 'enum bogus'}}38 39@interface fee  {40}41- (void)crashMe:(enum bogus)p;42@end43 44@implementation fee45- (void)crashMe:(enum bogus)p { // expected-error {{variable has incomplete type 'enum bogus'}}46}47@end48 49@interface arrayfun50- (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@end53 54@interface qux55- (void) my_method: (int)arg; // expected-note {{method 'my_method:' declared here}}56@end57 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@end63