summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/discr20.ads
blob: a447b3309c320a7fefac46c0a96ab682333b0973 (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
package Discr20 is

  Size : Integer;

  type Name is new String (1..Size);

  type Rec is record
     It : Name;
  end record;

  type Danger is (This, That);
  type def (X : Danger := This) is record
    case X is
       when This => It : Rec;
       when That => null;
       end case;
   end record;

   type Switch is (On, Off);
   type Wrapper (Disc : Switch := On) is private;
   function Get (X : Wrapper) return Def;

private
   type Wrapper (Disc : Switch := On) is record
      Case Disc is
         when On  => It : Def;
         when Off => null;
      end case;
   end record;

end Discr20;