summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/pack5.adb
blob: 12bea11a3110c2bd3c101020544b9564f52e76bd (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
-- { dg-do compile }

procedure Pack5 is

  type Kind is (v1, v2, v3);

  type Error (k : Kind := Kind'First) is record
    case k is
    when v1 =>
      null;
    when v2 =>
      null;
    when Others =>
      B : Boolean;
    end case;
  end record;
  pragma Pack (Error);
  for Error'Size use 16;

  No_Error: constant Error := (k => v2);

  type R (B : Boolean) is record
    E : Error;
  end record;
  pragma Pack(R);
  type Ptr is access R;

  C : Ptr := new R (True);

begin
  C.E := No_Error;
end;