aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/packed_subtype.adb
blob: 925440a41d85a63a72ecc6ea8684cbf5c645e5b3 (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
-- { dg-do run }

procedure Packed_Subtype is

   subtype Ubyte is Integer range 0 .. 255;
   type Packet (Id : Ubyte) is record
      A, B : Ubyte;
   end record;
   pragma Pack (Packet);

   subtype My_Packet is Packet (Id => 1);

   MP : My_Packet;
begin
   MP.A := 1;
   MP.B := 2;

   if MP.A /= 1 or else MP.B /= 2 then
      raise Program_Error;
   end if;
end;