PR target/84336
[official-gcc.git] / gcc / testsuite / gnat.dg / abstract1.adb
blob97508fac2b8ffb6e93e25d36d2b52ee87527af1d
1 -- { dg-do compile }
2 with Ada.Tags.Generic_Dispatching_Constructor; use Ada.Tags;
3 package body abstract1 is
5 function New_T (Stream : not null access Root_Stream_Type'Class)
6 return T'Class is
7 function Construct is
8 new Generic_Dispatching_Constructor (T, Root_Stream_Type'Class, Input);
9 E : constant String := String'Input (Stream);
10 I : constant Tag := Internal_Tag (E);
12 begin
13 return Construct (I, Stream);
14 end New_T;
16 function Input (Stream : not null access Root_Stream_Type'Class)
17 return IT is
18 begin
19 return O : IT do
20 Integer'Read (Stream, O.I);
21 end return;
22 end Input;
24 function Input (Stream : not null access Root_Stream_Type'Class)
25 return FT is
26 begin
27 return O : FT do
28 Float'Read (Stream, O.F);
29 end return;
30 end Input;
31 end abstract1;