Replace absolute linenrs in objc.dg,obj-c++.dg
[official-gcc.git] / gcc / testsuite / obj-c++.dg / method-1.mm
blob7317ae2aa87c9359f24e7a58e7b23f74a950fd8e
1 /* Test whether casting 'id' to a specific class removes method lookup
2    ambiguity.  */
3 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
5 /* { dg-do compile } */
7 #include <objc/objc.h>
9 @class Int1, Int2;
11 @interface Int1
12 + (Int1 *)classMethod1;
13 + (id)classMethod2;
14 - (Int1 *)instanceMethod:(Int2 *)arg;  /* { dg-bogus "using" } */
15 @end
17 @interface Int2: Int1
18 + (Int1 *)classMethod1; 
19 + (id)classMethod2;
20 - (id)int2Method;
21 - (int)instanceMethod:(int)arg;  /* { dg-bogus "also found" } */
22 @end
24 int main(void) {
25   id i = [(Int2 *)[Int1 classMethod1] int2Method]; /* { dg-line i_def } */
26         /* { dg-bogus "may not respond to" "" { target *-*-* } i_def } */
27   int j = [(Int2 *)[Int2 classMethod2] instanceMethod: 45];  /* { dg-bogus "multiple methods" } */
28         /* { dg-bogus "invalid conversion" "" { target *-*-* } i_def } */
29         /* { dg-bogus "invalid conversion" "" { target *-*-* } i_def } */
30   return j;