Debian Codegraph @

gcc/testsuite/gnat.dg/specs/pack3.ads

raw
1 -- { dg-do compile }
2
3 with Pack3_Pkg;
4
5 package Pack3 is
6
7 subtype N_TYPE is INTEGER range 0..5;
8
9 type LIST_ARRAY is array (N_TYPE range <>) of INTEGER;
10
11 type LIST (N : N_TYPE := 0) is record
12 LIST : LIST_ARRAY(1..N);
13 end record;
14 pragma PACK(LIST);
15
16 subtype CS is STRING(1..Pack3_Pkg.F);
17
18 type CSA is array (NATURAL range <>) of CS;
19
20 type REC is record
21 I1, I2 : INTEGER;
22 end record ;
23
24 type CMD is (CO, AS);
25
26 type CMD_BLOCK_TYPE (D : CMD := CO) is record
27 N : CSA (1..4);
28 case D is
29 when CO => L : LIST;
30 when AS => R : REC;
31 end case ;
32 end record;
33 pragma PACK(CMD_BLOCK_TYPE);
34
35 type CMD_TYPE is (RIGHT, WRONG);
36
37 type CMD_RESULT (D : CMD_TYPE) is record
38 case D is
39 when RIGHT => C : CMD_BLOCK_TYPE;
40 when WRONG => null;
41 end case;
42 end record ;
43 pragma PACK(CMD_RESULT);
44
45 end Pack3;