aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/discr27.adb
blob: 4b77f8efab9910f9e3098a60e545b92acf9b45d2 (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
30
31
32
33
-- { dg-do compile }

package body Discr27 is

   subtype Index is Positive range 1..4096;

   function F return String is
      S : String(1..1) := (others =>'w');
   begin
      return S;
   end;

   type Enum is (One, Two);

   type Rec (D : Enum  := One; Len : Index := 1) is record
      case D is
          when One => I : Integer;
          when Two => A : String(1..Len);
      end case;
   end record;

   procedure Nothing is
      M : constant String := F;
      C : constant Rec := (Two, M'Length, M);
   begin
      null;
   end;

   procedure Proc is begin
      null;
   end;

end Discr27;