aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/discr39.adb
blob: 1ffb972dc2c2a6b5877fcdd2852dbba9c883db37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- { dg-do run }

with System.Storage_Elements; use System.Storage_Elements;

procedure Discr39 is

  type Rec (Has_Src : Boolean) is record
     case Has_Src is
        when True  => Src : aliased Integer;
        when False => null;
     end case;
  end record;
  pragma Pack(Rec);
  for Rec'Alignment use Integer'Alignment;

  R : Rec (Has_Src => True);

begin
  if R.Src'Address mod Integer'Alignment /= 0 then
     raise Program_Error;
  end if;
end;