OSDN Git Service

New testcases
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc / execute / object_is_meta_class.m
1 /* Contributed by Nicola Pero - Tue Jul  3 10:55:21 BST 2001 */
2 #include <objc/objc.h>
3 #include <objc/objc-api.h>
4 #include <objc/Object.h>
5
6 #include "next_mapping.h"
7
8 /* This test demonstrate a failure in object_is_meta_class which was fixed */
9
10 @interface EvilClass : Object
11 {
12   Class super_class;
13   const char* name;
14   long version;
15   unsigned long info;    
16 }
17 @end
18
19 @implementation EvilClass
20 - (id) init
21 {
22   self = [super init];
23   /* The following one is used in the runtime to mark meta classes */
24   info = 0x2L;
25   return self;
26 }
27 @end
28
29 int main (void)
30 {
31   /* Create an object of our EvilClass */
32   EvilClass *evilObject = [EvilClass new];
33   
34   /* Now check that the object is not a meta class object */
35   if (object_is_meta_class (evilObject))
36     {
37       printf ("object_is_meta_class failed\n");
38       abort ();
39     }
40
41   return 0;
42 }
43