OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [method-9.m] - Blame information for rev 645

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

Line No. Rev Author Line
1 149 jeremybenn
/* Check if finding multiple signatures for a method is handled gracefully
2
   when method lookup succeeds (see also method-7.m).  */
3
/* Contributed by Ziemowit Laski <zlaski@apple.com>  */
4
 
5
/* { dg-do compile } */
6
/* { dg-options "-Wstrict-selector-match" } */
7
 
8
#include <objc/Object.h>
9
 
10
@protocol MyObject
11
- (id)initWithData:(Object *)data;
12
@end
13
 
14
@protocol SomeOther
15
- (id)initWithData:(int)data;
16
@end
17
 
18
@protocol MyCoding
19
- (id)initWithData:(id<MyObject, MyCoding>)data;
20
@end
21
 
22
@interface NTGridDataObject: Object <MyCoding>
23
{
24
    Object<MyCoding> *_data;
25
}
26
+ (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data;
27
@end
28
 
29
@implementation NTGridDataObject
30
- (id)initWithData:(id<MyObject, MyCoding>)data {
31
  return data;
32
}
33
+ (NTGridDataObject*)dataObject:(id<MyObject, MyCoding>)data
34
{
35
    NTGridDataObject *result = [[NTGridDataObject alloc] initWithData:data];
36
    /* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 35 } */
37
    /* { dg-warning "using .\\-\\(id\\)initWithData:\\(Object \\*\\)data." "" { target *-*-* } 11 } */
38
    /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(id <MyObject, MyCoding>\\)data." "" { target *-*-* } 19 } */
39
    /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(int\\)data." "" { target *-*-* } 15 } */
40
 
41
    /* The following warning is a consequence of picking the "wrong" method signature.  */
42
    /* { dg-warning "passing argument 1 of .initWithData:. from distinct Objective\\-C type" "" { target *-*-* } 35 } */
43
    return result;
44
}
45
@end

powered by: WebSVN 2.1.0

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