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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [call-super-3.m] - Blame information for rev 214

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

Line No. Rev Author Line
1 149 jeremybenn
/* Check if sending messages to super does not interfere with sending messages
2
   to classes. */
3
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
4
/* { dg-do run } */
5
/* { dg-options "-lobjc" } */
6
 
7
#include <objc/Object.h>
8
 
9
extern void abort(void);
10
#define CHECK_IF(expr) if(!(expr)) abort()
11
 
12
@interface Base: Object
13
+ (int) class_func1;
14
- (int) instance_func1;
15
@end
16
 
17
@interface Derived: Base
18
+ (int) class_func1;
19
@end
20
 
21
@interface Derived (Categ)
22
- (int) instance_func1;
23
@end
24
 
25
@implementation Base
26
+ (int) class_func1 { return 234; }
27
- (int) instance_func1 { return 345; }
28
@end
29
 
30
@implementation Derived
31
+ (int) class_func1 {
32
  int i = [super class_func1];
33
  i += [Base class_func1];
34
  return i;
35
}
36
@end
37
 
38
@implementation Derived (Categ)
39
- (int) instance_func1 {
40
  int i = [super instance_func1];
41
  i += [Base class_func1];  /* { dg-bogus "invalid receiver type" } */
42
  return i;
43
}
44
@end
45
 
46
int main(void) {
47
  Base *base = [[Base alloc] init];  /* { dg-bogus "invalid receiver type" } */
48
  Derived *derived = [[Derived alloc] init];
49
  CHECK_IF([Base class_func1] == 234);  /* { dg-bogus "invalid receiver type" } */
50
  CHECK_IF([Derived class_func1] == 234 + 234);
51
  CHECK_IF([base instance_func1] == 345);
52
  CHECK_IF([derived instance_func1] == 234 + 345);
53
  return 0;
54
}

powered by: WebSVN 2.1.0

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