Debian Codegraph @

gcc/testsuite/gnat.dg/generic_call_cw.adb

raw
1 -- { dg-do compile }
2
3 procedure Generic_Call_CW is
4
5 generic
6 type Subscriber_Type is tagged private;
7 with procedure On_Changed (Subscriber : in out Subscriber_Type'Class);
8 package My_Generic is
9 type Subscriber_Ptr is access all Subscriber_Type'Class;
10 procedure Update;
11 Subscriber : Subscriber_Ptr := null;
12 end;
13
14 package body My_Generic is
15 procedure Update is
16 begin
17 if Subscriber /= null then
18 Subscriber.On_Changed;
19 end if;
20 end;
21 end;
22
23 package User is
24 type Integer_Subscriber is tagged null record;
25 procedure On_Changed_Int (I : in out Integer_Subscriber'Class) is null;
26
27 package P is new My_Generic
28 (Subscriber_Type => Integer_Subscriber,
29 On_Changed => On_Changed_Int);
30 end;
31 begin
32 null;
33 end;