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

Subversion Repositories openrisc

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

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 but conflicting method signatures.  */
8
 
9
@protocol MyProtocol
10
+ (int) method1: (int)x;   /* { dg-message "previous declaration" } */
11
+ (float) method1: (int)x; /* { dg-error "duplicate declaration of method .\\+method1." } */
12
 
13
- (int) method2: (int)x;   /* { dg-message "previous declaration" } */
14
- (int) method2: (float)x; /* { dg-error "duplicate declaration of method .\\-method2." } */
15
 
16
@optional
17
+ (int *) method3: (int)x;    /* { dg-message "previous declaration" } */
18
+ (int *) method3: (int **)x; /* { dg-error "duplicate declaration of method .\\+method3." } */
19
 
20
- (id) method4: (id)x;   /* { dg-message "previous declaration" } */
21
- (void) method4: (id)x; /* { dg-error "duplicate declaration of method .\\-method4." } */
22
@end
23
 
24
/* We don't test conflicting types between @required and @optional
25
   methods, as that is tested in method-conflict-2.  */
26
 

powered by: WebSVN 2.1.0

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