aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/derived_type2.adb
blob: 607eb0b22c4624aed5008e28212f5f81315bfbcd (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
34
35
36
37
38
39
40
-- { dg-do run }
-- { dg-options "-gnatws" }

procedure Derived_Type2 is

   package Pkg is

      type Parent (B : Boolean := True) is record
         case B is
            when True => S : String (1 .. 5);
            when False => F : Float;
         end case;
      end record;

      function Create (X : Parent) return Parent;

   end Pkg;

   package body Pkg is

      function Create (X : Parent) return Parent is
      begin
         return (True, "12345");
      end;

   end Pkg;

   use Pkg;

   type T is new Parent (True);

   X : T;

begin

   if Create (X).B /= True then
      raise Program_Error;
   end if;

end;