summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/abstract1.adb
blob: 97508fac2b8ffb6e93e25d36d2b52ee87527af1d (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
--  { dg-do compile }
with Ada.Tags.Generic_Dispatching_Constructor;  use Ada.Tags;
package body abstract1 is
   
   function New_T (Stream : not null access Root_Stream_Type'Class)
      return T'Class is
      function Construct is
         new Generic_Dispatching_Constructor (T, Root_Stream_Type'Class, Input);
      E : constant String := String'Input (Stream);
      I : constant Tag := Internal_Tag (E);
   
   begin
      return Construct (I, Stream);
   end New_T;
   
   function Input (Stream : not null access Root_Stream_Type'Class)
     return IT is
   begin
      return O : IT do
        Integer'Read (Stream, O.I);
      end return;
   end Input;
   
   function Input (Stream : not null access Root_Stream_Type'Class)
      return FT is
   begin
      return O : FT do
        Float'Read (Stream, O.F);
      end return;                                              
   end Input;                                                  
end abstract1;