1 /* Ensure that we indeed cannot obtain the value of a message send
2 if the chosen method signature returns 'void'. There used to
3 exist a cheesy hack that allowed it. While at it, check that
4 the first lexically occurring method signature gets picked
5 when sending messages to 'id'. */
6 /* Contributed by Ziemowit Laski <zlaski@apple.com> */
7 /* { dg-do compile } */
12 - (void)initWithData:(Object1 *)data;
16 - (id)initWithData:(Object1 *)data;
20 - (id)initWithData:(Object2 *)data;
25 obj2 = [obj1 initWithData: obj2];
26 /* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 25 } */
27 /* { dg-warning "using .\\-\\(void\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 12 } */
28 /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 16 } */
29 /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(Object2 \\*\\)data." "" { target *-*-* } 20 } */
31 /* The following error is a consequence of picking the "wrong" method signature. */
32 /* { dg-error "void value not ignored as it ought to be" "" { target *-*-* } 25 } */