c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / gnat.dg / discr58.adb
blobbb6f5bfedce9a0b9d5b7df177130ca535f9396c2
1 -- { dg-do compile }
3 with Ada.Text_IO; use Ada.Text_IO;
5 procedure Discr58 is
7 type Field(Flag : Boolean := True) is record
8 case Flag is
9 when True => Param1 : Boolean := False;
10 when False => Param2 : Boolean := True;
11 end case;
12 end record;
14 type Header(Flag : Boolean := True) is record
15 Param3 : Integer := 0;
16 Params : Field(Flag) := (if Flag = True then
17 (Flag => True, others => <>)
18 else
19 (Flag => False, others => <>));
20 end record;
22 type Message(Flag : Boolean) is record
24 -- This assignment crashes GNAT
25 The_Header : Header(Flag) := Header'(Flag => True, others => <>);
26 end record;
28 It : Message (True);
29 begin
30 Put_Line("Hello World");
31 Put_Line (Boolean'Image (It.The_Header.Flag));
32 Put_Line (Boolean'Image (It.The_Header.Params.Flag));
33 end Discr58;