OSDN Git Service

restore darwin8 objc/c++ test functionality.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc / execute / enumeration-2.m
1 /* Contributed by Nicola Pero -  Wed Dec  5 17:12:40 GMT 2001 */
2 #include <stdlib.h>
3 #import "../../objc-obj-c++-shared/Object1.h"
4 #include <objc/objc.h>
5
6 typedef enum { black, white } color;
7
8 typedef struct 
9 {
10   color a:2;
11   color b:2;
12 } color_couple;
13
14 @interface TestClass: Object
15 {
16   color_couple *c;
17 }
18 - (color_couple *)colorCouple;
19 - (void)setColorCouple: (color_couple *)a;
20 @end
21
22 @implementation TestClass
23 - (color_couple *)colorCouple
24 {
25   return c;
26 }
27 - (void)setColorCouple: (color_couple *)a
28 {
29   c = a;
30 }
31 @end
32
33
34 int main (void)
35 {
36   color_couple cc;
37   TestClass *c;
38   
39   c = [TestClass new];
40   
41   cc.a = black;
42   cc.b = white;
43
44   [c setColorCouple: &cc];
45   if ([c colorCouple] != &cc)
46     {
47       abort ();
48     }
49   
50
51   return 0;
52 }