Preserving locations for variable-uses and constants (PR c++/43486)
[official-gcc.git] / gcc / testsuite / gnat.dg / unchecked_union2.adb
blobccb6e60e7bc4c1c21fad18609c1532d7891693a9
1 -- { dg-do compile }
3 procedure Unchecked_Union2 is
4 type small_array is array (0 .. 2) of Integer;
5 type big_array is array (0 .. 3) of Integer;
7 type small_record is record
8 field1 : aliased Integer := 0;
9 field2 : aliased small_array := (0, 0, 0);
10 end record;
12 type big_record is record
13 field1 : aliased Integer := 0;
14 field2 : aliased big_array := (0, 0, 0, 0);
15 end record;
17 type myUnion (discr : Integer := 0) is record
18 case discr is
19 when 0 =>
20 record1 : aliased small_record;
21 when others =>
22 record2 : aliased big_record;
23 end case;
24 end record;
26 type UU_myUnion3 (discr : Integer := 0) is new myUnion (discr); -- Test
27 pragma Unchecked_Union (UU_myUnion3);
28 pragma Convention (C, UU_myUnion3);
30 procedure Convert (A : in UU_myUnion3; B : out UU_myUnion3);
31 pragma Import (C, Convert);
33 begin
34 null;
35 end Unchecked_Union2;