2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gnat.dg / outer_agg_bitfield_constructor.adb
blob6658042e9630f03e5856c08e9c5f536fe0b1fb3b
1 -- { dg-do run }
3 procedure Outer_Agg_Bitfield_Constructor is
5 type Mod_64 is mod 2 ** 64;
6 for Mod_64'Size use 64;
8 type Uint_16 is range 0 .. 2 ** 16 - 1;
9 for Uint_16'Size use 16;
11 type Values_Type is record
12 M64 : Mod_64;
13 U16 : Uint_16;
14 end record;
16 for Values_Type use record
17 M64 at 0 range 0 .. 63;
18 U16 at 8 range 0 .. 15;
19 end record;
21 type Wrapper_Type is record
22 Values : Values_Type;
23 end record;
25 for Wrapper_Type use record
26 Values at 0 range 0 .. 79;
27 end record;
29 M : constant := 2;
30 U : constant := 4;
32 W : Wrapper_Type := (Values => (M, U));
34 procedure Check (O : Wrapper_Type) is
35 begin
36 if O.Values.M64 /= M or else O.Values.U16 /= U then
37 raise Program_Error;
38 end if;
39 end;
40 begin
41 Check (W);
42 end;