Debian Codegraph @

gcc/testsuite/gnat.dg/protected_deref1.adb

raw
1 -- { dg-do run }
2
3 with Ada.Text_IO;
4
5 procedure Protected_Deref1 is
6
7 protected type Fallback_Hit_Counter_Type is
8 procedure Handler;
9 end Fallback_Hit_Counter_Type;
10
11 protected body Fallback_Hit_Counter_Type is
12 procedure Handler is
13 begin
14 Ada.Text_IO.Put_Line ("Test");
15 end Handler;
16 end Fallback_Hit_Counter_Type;
17
18 Fallback_Hit_Counter : access Fallback_Hit_Counter_Type :=
19 new Fallback_Hit_Counter_Type;
20
21 type X is access protected procedure;
22
23 A : X := Fallback_Hit_Counter.all.Handler'Access;
24 B : X := Fallback_Hit_Counter.Handler'Access;
25
26 begin
27 A.all;
28 B.all;
29 if A /= B then
30 raise Program_Error;
31 end if;
32 end;