OSDN Git Service

* obj-c++.dg/defs.mm (abort): Make it extern "C".
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / obj-c++.dg / isa-field-1.mm
1 /* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects.  */
2 /* { dg-do compile } */
3 /* { dg-xfail-if "PR23613" { "*-*-*" } { "*" } { "" } } */
4
5 #include <objc/Object.h>
6
7 @interface Object (Test)
8 - (Class) test1: (id)object;
9 @end
10
11 @interface Derived: Object
12 - (Class) test2: (id)object;
13 @end
14
15 @implementation Object (Test)
16
17 Class test1(id object) {
18   Class cls = object->isa;
19   return cls;
20 }
21 - (Class) test1: (id)object {
22   Class cls = object->isa;
23   return cls;
24 }
25
26 @end
27
28 @implementation Derived
29
30 Class test2(id object) {
31   Class cls = object->isa;
32   return cls;
33 }
34 - (Class) test2: (id)object {
35   Class cls = object->isa;
36   return cls;
37 }
38
39 @end
40
41 Class test3(id object) {
42   Class cls = object->isa;
43   return cls;
44 }