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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [method-3.m] - Blame information for rev 844

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test for sending messages to aliased classes (and instances thereof).  */
2
/* Author: Ziemowit Laski <zlaski@apple.com>.  */
3
/* { dg-options "-lobjc" } */
4
/* { dg-do run } */
5
 
6
#include <objc/Object.h>
7
 
8
extern void abort(void);
9
#define CHECK_IF(expr) if(!(expr)) abort()
10
 
11
@interface Int1: Object
12
+ (int) classMeth;
13
- (int) instanceMeth;
14
@end
15
 
16
@interface Int2: Object
17
+ (int) classMeth;
18
- (int) instanceMeth;
19
@end
20
 
21
@implementation Int1
22
+ (int) classMeth { return 345; }
23
- (int) instanceMeth { return 697; }
24
@end
25
 
26
@implementation Int2
27
+ (int) classMeth { return 1345; }
28
- (int) instanceMeth { return 1697; }
29
@end
30
 
31
typedef Int1 Int1Typedef;
32
@compatibility_alias Int1Alias Int1Typedef;
33
@compatibility_alias Int2Alias Int2;
34
typedef Int2Alias Int2Typedef;
35
 
36
int main(void) {
37
  Int1Alias *int1alias = [[Int1Typedef alloc] init];
38
  Int2Typedef *int2typedef = [[Int2Alias alloc] init];
39
 
40
  CHECK_IF([Int1Typedef classMeth] == 345 && [Int2Alias classMeth] == 1345);
41
  CHECK_IF([int1alias instanceMeth] == 697 && [int2typedef instanceMeth] == 1697);
42
  CHECK_IF([(Int2Typedef *)int1alias instanceMeth] == 697);
43
  CHECK_IF([(Int1Alias *)int2typedef instanceMeth] == 1697);
44
  return 0;
45
}

powered by: WebSVN 2.1.0

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