summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/specs/pack3.ads
blob: ba2b34683294c5efa17d161d9417f9902ae450f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-- { dg-do compile }

with Pack3_Pkg;

package Pack3 is

  subtype N_TYPE is INTEGER range 0..5;

  type LIST_ARRAY is array (N_TYPE range <>) of INTEGER;

  type LIST (N : N_TYPE := 0) is record
    LIST : LIST_ARRAY(1..N);
  end record;
  pragma PACK(LIST);

  subtype CS is STRING(1..Pack3_Pkg.F);

  type CSA is array (NATURAL range <>) of CS;

  type REC is record
    I1, I2 : INTEGER;
  end record ;

  type CMD is (CO, AS);

  type CMD_BLOCK_TYPE (D : CMD := CO) is record
    N : CSA (1..4);
    case D is
      when CO => L : LIST;
      when AS => R : REC;
    end case ;
  end record;
  pragma PACK(CMD_BLOCK_TYPE);

  type CMD_TYPE is (RIGHT, WRONG);

  type CMD_RESULT (D : CMD_TYPE) is record
    case D is
      when RIGHT => C : CMD_BLOCK_TYPE;
      when WRONG => null;
    end case;
  end record ;
  pragma PACK(CMD_RESULT);

end Pack3;