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