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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [obj-c++.dg/] [method-16.mm] - Blame information for rev 820

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

Line No. Rev Author Line
1 149 jeremybenn
 
2
/* Ensure that we indeed cannot obtain the value of a message send
3
   if the chosen method signature returns 'void'.  There used to
4
   exist a cheesy hack that allowed it.  While at it, check that
5
   the first lexically occurring method signature gets picked
6
   when sending messages to 'id'.  */
7
/* Contributed by Ziemowit Laski   */
8
/* { dg-do compile } */
9
 
10
#include 
11
 
12
@interface Object1
13
- (void)initWithData:(Object1 *)data;
14
@end
15
 
16
@interface Object2
17
- (id)initWithData:(Object1 *)data;
18
@end
19
 
20
@interface Object3
21
- (id)initWithData:(Object2 *)data;
22
@end
23
 
24
void foo(void) {
25
  id obj1, obj2 = 0;
26
  obj2 = [obj1 initWithData: obj2];
27
     /* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 26 } */
28
     /* { dg-warning "using .\\-\\(void\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 13 } */
29
     /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 17 } */
30
     /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(Object2 \\*\\)data." "" { target *-*-* } 21 } */
31
 
32
     /* The following error is a consequence of picking the "wrong" method signature.  */
33
     /* { dg-error "void value not ignored as it ought to be" "" { target *-*-* } 26 } */
34
}

powered by: WebSVN 2.1.0

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