aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/varsize_temp.adb
blob: b7c3a0b6039767ac741be1ec73e4e175246a9056 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- { dg-do compile }

procedure Varsize_Temp (Nbytes : Natural) is

   type Message_T (Length : Natural) is record
      case Length is
         when 0 => null;
         when others => Id : Natural;
      end case;
   end record;

   type Local_Message_T is new Message_T (Nbytes);

   function One_message return Local_Message_T is
      M : Local_Message_T;
   begin
      if M.Length > 0 then
         M.Id := 1;
      end if;
      return M;
   end;

   procedure Process (X : Local_Message_T) is begin null; end;

begin
   Process (One_Message);
end;