Merged r157653 through r157895 into branch.
[official-gcc.git] / gcc / testsuite / obj-c++.dg / isa-field-1.mm
blob4b93df8c485554389b89b2da680ff958a12ad03f
1 /* Ensure there are no bizarre difficulties with accessing the 'isa' field of
2   objects.  This field is named differently between GNU and NeXT runtimes so
3   accessed via the CLASSPTRFIELD() macro defined in next-mapping.h */
4 /* { dg-do compile } */
6 #include "../objc-obj-c++-shared/Object1.h"
7 #include "../objc-obj-c++-shared/next-mapping.h"
9 @interface Object (Test)
10 - (Class) test1: (id)object;
11 @end
13 @interface Derived: Object
14 - (Class) test2: (id)object;
15 @end
17 @implementation Object (Test)
19 Class test1(id object) {
20   Class cls = CLASSPTRFIELD(object);
21   return cls;
23 - (Class) test1: (id)object {
24   Class cls = CLASSPTRFIELD(object);
25   return cls;
28 @end
30 @implementation Derived
32 Class test2(id object) {
33   Class cls = CLASSPTRFIELD(object);
34   return cls;
36 - (Class) test2: (id)object {
37   Class cls = CLASSPTRFIELD(object);
38   return cls;
41 @end
43 Class test3(id object) {
44   Class cls = CLASSPTRFIELD(object);
45   return cls;
47 #include "../objc-obj-c++-shared/Object1-implementation.h"