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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [method-conflict-4.m] - Blame information for rev 704

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2
/* { dg-do compile } */
3
 
4
#include <objc/objc.h>
5
 
6
/* Test that the compiler can correctly compare protocols in types of
7
   method signatures.  In this test we look at protocols implementing
8
   other protocols.  The fact that one protocol implements another one
9
   doesn't mean that they are identical.  */
10
 
11
@protocol A
12
- (void) doSomething;
13
@end
14
 
15
@protocol B <A>
16
- (void) doSomethingElse;
17
@end
18
 
19
@protocol C <A>
20
- (void) doYetSomethingElse;
21
@end
22
 
23
@interface MyClass2
24
- (void) aMethod: (id <A>)x;  /* { dg-message "previous declaration" } */
25
- (void) aMethod: (id <B>)x;  /* { dg-error "duplicate declaration" } */
26
 
27
- (void) bMethod: (id <B>)x;  /* { dg-message "previous declaration" } */
28
- (void) bMethod: (id <A>)x;  /* { dg-error "duplicate declaration" } */
29
 
30
- (void) cMethod: (id <A, B>)x;
31
- (void) cMethod: (id <B>)x;  /* Ok - because if you implement B, then you also implement A, so <B> == <A, B> */
32
 
33
- (void) dMethod: (id <A, B>)x;
34
- (void) dMethod: (id <B, A>)x; /* Ok */
35
 
36
- (void) eMethod: (id <A>)x;  /* { dg-message "previous declaration" } */
37
- (void) eMethod: (id <B, C>)x;  /* { dg-error "duplicate declaration" } */
38
 
39
- (void) fMethod: (id <B, C>)x;  /* { dg-message "previous declaration" } */
40
- (void) fMethod: (id <A>)x;  /* { dg-error "duplicate declaration" } */
41
 
42
- (void) gMethod: (id <A>)x;  /* { dg-message "previous declaration" } */
43
- (void) gMethod: (id <A, B, C>)x;  /* { dg-error "duplicate declaration" } */
44
 
45
- (void) hMethod: (id <A, B, C>)x;  /* { dg-message "previous declaration" } */
46
- (void) hMethod: (id <A>)x;  /* { dg-error "duplicate declaration" } */
47
@end

powered by: WebSVN 2.1.0

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