OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [obj-c++.dg/] [method-1.mm] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* Test whether casting 'id' to a specific class removes method lookup
2
   ambiguity.  */
3
/* Author: Ziemowit Laski .  */
4
 
5
/* { dg-do compile } */
6
 
7
#include 
8
 
9
@class Int1, Int2;
10
 
11
@interface Int1
12
+ (Int1 *)classMethod1;
13
+ (id)classMethod2;
14
- (Int1 *)instanceMethod:(Int2 *)arg;  /* { dg-bogus "using" } */
15
@end
16
 
17
@interface Int2: Int1
18
+ (Int1 *)classMethod1;
19
+ (id)classMethod2;
20
- (id)int2Method;
21
- (int)instanceMethod:(int)arg;  /* { dg-bogus "also found" } */
22
@end
23
 
24
int main(void) {
25
  id i = [(Int2 *)[Int1 classMethod1] int2Method];   /* { dg-bogus "may not respond to" } */
26
  int j = [(Int2 *)[Int2 classMethod2] instanceMethod: 45];  /* { dg-bogus "multiple methods" } */
27
        /* { dg-bogus "invalid conversion" "" { target *-*-* } 25 } */
28
        /* { dg-bogus "invalid conversion" "" { target *-*-* } 25 } */
29
  return j;
30
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.