c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / gnat.dg / unchecked_union3.adb
blob638861a2854e550b849693610ff6ad3178658a71
1 -- { dg-do compile }
3 procedure Unchecked_Union3 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_myUnion1 is new myUnion;
27 pragma Unchecked_Union (UU_myUnion1);
28 pragma Convention (C, UU_myUnion1);
30 procedure Convert (A : in myUnion; B : out UU_myUnion1) is
31 L : UU_myUnion1 := UU_myUnion1 (A); -- Test
32 begin
33 B := L;
34 end Convert;
36 begin
37 null;
38 end Unchecked_Union3;