summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/specs/discr4_pkg.ads
blob: 231a8fb77e8a501529630c32f66e1ce75f4b2245 (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
package Discr4_Pkg is

   type Enum is (One, Two, Three);

   type Rec is private;

   Rec_One : constant Rec;
   Rec_Three  : constant Rec;

   function Get (Value : Integer) return Rec;

private

   type Rec (D : Enum := Two) is record
      case D is
         when One => null;
         when Two => Value : Integer;
         when Three => null;
      end case;
   end record;

   Rec_One   : constant Rec := (D => One);
   Rec_Three : constant Rec := (D => Three);

   function Get (Value : Integer) return Rec is (Two, Value);

end Discr4_Pkg;