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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc.dg/] [method-3.m] - Blame information for rev 316

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

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

powered by: WebSVN 2.1.0

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