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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [method-15.mm] - Blame information for rev 750

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

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

powered by: WebSVN 2.1.0

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