summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/isa-field-1.m
blob: 377280f0d992a8c30533d35b239df64a084821aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects.  */
/* { dg-do compile } */

#include "../objc-obj-c++-shared/Object1.h"

@interface Object (Test)
- (Class) test1: (id)object;
@end

@interface Derived: Object
- (Class) test2: (id)object;
@end

@implementation Object (Test)

Class test1(id object) {
#ifdef __NEXT_RUNTIME__
    Class cls = object->isa;
#else
    Class cls = object->class_pointer;
#endif
    return cls;
}
- (Class) test1: (id)object {
#ifdef __NEXT_RUNTIME__
    Class cls = object->isa;
#else
    Class cls = object->class_pointer;
#endif
    return cls;
}

@end

@implementation Derived

Class test2(id object) {
#ifdef __NEXT_RUNTIME__
    Class cls = object->isa;
#else
    Class cls = object->class_pointer;
#endif
    return cls;
}
- (Class) test2: (id)object {
#ifdef __NEXT_RUNTIME__
    Class cls = object->isa;
#else
    Class cls = object->class_pointer;
#endif
    return cls;
}

@end

Class test3(id object) {
#ifdef __NEXT_RUNTIME__
    Class cls = object->isa;
#else
    Class cls = object->class_pointer;
#endif
    return cls;
}