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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [method-11.m] - Blame information for rev 827

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

Line No. Rev Author Line
1 149 jeremybenn
/* 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 } */
8
 
9
#include <objc/objc.h>
10
 
11
@interface Object1
12
- (void)initWithData:(Object1 *)data;
13
@end
14
 
15
@interface Object2
16
- (id)initWithData:(Object1 *)data;
17
@end
18
 
19
@interface Object3
20
- (id)initWithData:(Object2 *)data;
21
@end
22
 
23
void foo(void) {
24
  id obj1, obj2 = 0;
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 } */
30
 
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 } */
33
}

powered by: WebSVN 2.1.0

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