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

procedure Unchecked_Union1 is

  type Bit is (Zero, One);

  type U (X : Bit := Zero) is record
    case X is
      when Zero => I: Integer;
      when One => F : Float;
    end case;
  end record;
  for U use record
    I at 0 range  0 .. 31;
    F at 0 range  0 .. 31;
  end record;
  pragma Unchecked_Union(U);

begin
  if U'Object_Size /= 32 then
    raise Program_Error;
  end if;
end;