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

Subversion Repositories openrisc

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

Go to most recent revision | 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 you can not declare two methods, in the same protocol,
7
   with the same name and method signature, but one as @required and
8
   once as @optional.  */
9
 
10
/* First, @required conflicting with @optional.  */
11
@protocol MyProtocol
12
 
13
@optional
14
+ (void) method1: (id)x; /* { dg-message "previous declaration" } */
15
- (id) method2: (long)x; /* { dg-message "previous declaration" } */
16
 
17
@required
18
+ (void) method1: (id)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
19
- (id) method2: (long)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
20
 
21
@end
22
 
23
/* Second, @optional conflicting with @required.  */
24
@protocol MyProtocol2
25
 
26
@required
27
+ (void) method3: (Class)x; /* { dg-message "previous declaration" } */
28
- (id *) method4: (long)x;  /* { dg-message "previous declaration" } */
29
 
30
@optional
31
+ (void) method3: (Class)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
32
- (id *) method4: (long)x;  /* { dg-error "declared .@optional. and .@required. at the same time" } */
33
 
34
@end

powered by: WebSVN 2.1.0

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