Debian Codegraph @

gcc/testsuite/gnat.dg/varsize1.adb

raw
1 -- { dg-do compile }
2
3 procedure Varsize1 (Nbytes : Natural) is
4
5 type Message_T (Length : Natural) is record
6 case Length is
7 when 0 => null;
8 when others => Id : Natural;
9 end case;
10 end record;
11
12 type Local_Message_T is new Message_T (Nbytes);
13
14 function One_message return Local_Message_T is
15 M : Local_Message_T;
16 begin
17 if M.Length > 0 then
18 M.Id := 1;
19 end if;
20 return M;
21 end;
22
23 procedure Process (X : Local_Message_T) is begin null; end;
24
25 begin
26 Process (One_Message);
27 end;