From: "Jérôme Haguet" <j.haguet@cadwin.com>
Subject: GNAT CE 2020 : error when using anon access to subprogram inside protected !?
Date: Tue, 2 Jun 2020 02:46:08 -0700 (PDT)
Date: 2020-06-02T02:46:08-07:00 [thread overview]
Message-ID: <73389630-ef9f-4a9a-918e-0ffc89f62e6c@googlegroups.com> (raw)
Hello
When I start testing existing code with GNAT CE 2020, I faced a compilation error when using anonymous access to subprogram inside protected body.
Maybe somebody can provide an explanation ...
Hereafter you will find the compiler message and (simplified) code that illustrates my problem
pb20200602.adb:27:18: subprogram "Do_On_Item" has wrong convention
pb20200602.adb:27:18: does not match access to subprogram declared at line 7
package Pb20200602 is
protected Tokens is
procedure Call_Walker;
end;
end;
-- ---------------------------------------------------------------------
with Ada.Text_Io;
package body Pb20200602 is
protected body Tokens is
procedure Walker
(On_Item : not null access procedure (Name : String);
Success : out Boolean
)
is
begin
On_Item.all ("John Doe");
On_Item.all ("Jane Doe");
Success := True;
end;
procedure Call_Walker
is
procedure Do_On_Item (Name : String)
is
begin
null;
end;
Success : Boolean := False;
begin
Walker (Do_On_Item'Access,
Success);
if Success then
Ada.Text_Io.Put_Line ("Success!");
end if;
end;
end;
end;
next reply other threads:[~2020-06-02 9:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 9:46 Jérôme Haguet [this message]
2020-06-02 12:04 ` GNAT CE 2020 : error when using anon access to subprogram inside protected !? Simon Wright
2020-06-03 6:36 ` Simon Wright
2020-06-03 9:54 ` J-P. Rosen
2020-06-02 13:51 ` J-P. Rosen
2020-06-02 14:37 ` Simon Wright
2020-06-02 14:55 ` Dmitry A. Kazakov
2020-06-02 18:02 ` AdaMagica
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox