tree-optimization/116842 - vectorizer load hosting breaks UID order
[official-gcc.git] / gcc / testsuite / objc.dg / isa-field-1.m
bloba786ec3deb50588d1bed1e4b6d3e8323215837e5
1 /* Ensure there are no bizarre difficulties with accessing the 'isa' field of objects.  */
2 /* { dg-do compile } */
3 /* The use of isa is deprecated, but we still want to test that it works. */
4 /* { dg-additional-options "-Wno-deprecated-declarations" } */
6 #include "../objc-obj-c++-shared/TestsuiteObject.h"
7 #include "../objc-obj-c++-shared/runtime.h"
9 @interface TestsuiteObject (Test)
10 - (Class) test1: (id)object;
11 @end
13 @interface Derived: TestsuiteObject
14 - (Class) test2: (id)object;
15 @end
17 @implementation TestsuiteObject (Test)
19 Class test1(id object) {
20 #ifdef __NEXT_RUNTIME__
21     Class cls = object->isa;
22 #else
23     Class cls = object->class_pointer;
24 #endif
25     return cls;
27 - (Class) test1: (id)object {
28 #ifdef __NEXT_RUNTIME__
29     Class cls = object->isa;
30 #else
31     Class cls = object->class_pointer;
32 #endif
33     return cls;
36 @end
38 @implementation Derived
40 Class test2(id object) {
41 #ifdef __NEXT_RUNTIME__
42     Class cls = object->isa;
43 #else
44     Class cls = object->class_pointer;
45 #endif
46     return cls;
48 - (Class) test2: (id)object {
49 #ifdef __NEXT_RUNTIME__
50     Class cls = object->isa;
51 #else
52     Class cls = object->class_pointer;
53 #endif
54     return cls;
57 @end
59 Class test3(id object) {
60 #ifdef __NEXT_RUNTIME__
61     Class cls = object->isa;
62 #else
63     Class cls = object->class_pointer;
64 #endif
65     return cls;