From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,PLING_QUERY autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.6k1R0IQgF+3y+m4EkNohlQ.user.gioia.aioe.org!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: GNAT CE 2020 : error when using anon access to subprogram inside protected !? Date: Tue, 02 Jun 2020 13:04:05 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <73389630-ef9f-4a9a-918e-0ffc89f62e6c@googlegroups.com> NNTP-Posting-Host: 6k1R0IQgF+3y+m4EkNohlQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (darwin) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:Ii4/dNq16d4EhPNf2Nm3qCZMuLU= Xref: reader01.eternal-september.org comp.lang.ada:58932 Date: 2020-06-02T13:04:05+01:00 List-Id: Jérôme Haguet writes: > When I start testing existing code with GNAT CE 2020, I faced a > compilation error when using anonymous access to subprogram inside > protected body. > 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; I'm amazed that you can declare Walker inside the PO! CE 2020 will compile this without complaint if you move Walker outside the PO.