Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / obj-c++.dg / bitfield-3.mm
blob1ad10f642864b8ba52eb2b60e5d1a4fc1aa0408c
1 /* Check if bitfield ivars are correctly @encode'd when
2    the NeXT runtime is used.  */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
4 /* { dg-options "-fnext-runtime -fsigned-char" } */
5 /* { dg-do run { target *-*-darwin* } } */
7 typedef struct objc_object { struct objc_class *class_pointer; } *id;
9 #include <stdlib.h>
10 #include <string.h>
12 #define CHECK_IF(expr) if(!(expr)) abort();
14 @interface Base 
16     struct objc_class *isa;
17     int full;
18     int full2: 32;
19     int _refs: 8;
20     int field2: 3;
21     unsigned f3: 8;
22     short cc;
23     unsigned g: 16;
24     int r2: 8;
25     int r3: 8;
26     int r4: 2;
27     int r5: 8;
28     char c;
30 @end
32 @interface Derived: Base
34     char d;
35     int _field3: 6;
37 @end
39 @implementation Base
40 @end
42 @implementation Derived
43 @end
45 int main(void) {
46   const char *s1r = "{Base=#ib32b8b3b8sb16b8b8b2b8c}";
47   const char *s1 = @encode(Base);
48   const char *s2r = "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}";
49   const char *s2 = @encode(Derived);
51   CHECK_IF(!strcmp(s1r, s1));
52   CHECK_IF(!strcmp(s2r, s2));
54   return 0;