summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/named_test.adb
blob: 1d271ba5cd91ce4c49937d2b75d0c3179d86160d (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
-- { dg-do run }

with Text_IO; use Text_IO;
procedure Named_Test is
   type Base is tagged limited record
      Flag  : boolean;
      Value : integer;
   end record;
-- 
   function Build (X : Integer; Y : Integer) return Base is
   begin
      return Result : Base do
         Result.Flag := (X = Y);
         Result.Value := X * Y;
      end return;
   end;
-- 
   type Table is array (1..1) of Base;
   It : Table := (1 => Build ( Y => 17, X => 11));
begin
  if It (1).Flag
    or else It (1).Value /= 187
  then
     raise Program_Error;
  end if;
end;