aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/aliased2.adb
blob: 0e1adacd8981e617407ce777826698a4484468b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- { dg-do run }

procedure Aliased2 is

  type Rec is record
    Data : access constant String;
  end record;

  function Get (S : aliased String) return Rec is
    R : Rec := (Data => S'Unchecked_Access);
  begin
    return R;
  end;

  S : aliased String := "Hello";

  R : Rec := Get (S);

begin
  if R.Data'Length /= S'Length then
    raise Program_Error;
  end if;
end;