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

procedure Pack4 is

   type Time_T is record
      Hour : Integer;
   end record;

   type Date_And_Time_T is record
      Date : Integer;
      Time : Time_T;
   end record;

   pragma Pack(Date_And_Time_T);

   procedure
     Assign_Hour_Of (T : out Time_T)
   is
   begin
      T.Hour := 44;
   end;

   procedure
     Clobber_Hour_Of (DT: out Date_And_Time_T)
   is
   begin
      Assign_Hour_Of (Dt.Time);
   end;

   DT : Date_And_Time_T;

begin
   DT.Time.Hour := 22;
   Clobber_Hour_Of (DT);
   if DT.Time.Hour /= 44 then
     raise Program_Error;
   end if;
end;