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 X-Received: by 2002:ad4:54ea:: with SMTP id k10mr812354qvx.66.1591091168627; Tue, 02 Jun 2020 02:46:08 -0700 (PDT) X-Received: by 2002:a9d:7312:: with SMTP id e18mr5968790otk.182.1591091168239; Tue, 02 Jun 2020 02:46:08 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 2 Jun 2020 02:46:08 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=78.240.194.81; posting-account=d5j2DQoAAABeZhUIl30hw1xF6LEcGIMa NNTP-Posting-Host: 78.240.194.81 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <73389630-ef9f-4a9a-918e-0ffc89f62e6c@googlegroups.com> Subject: GNAT CE 2020 : error when using anon access to subprogram inside protected !? From: =?UTF-8?B?SsOpcsO0bWUgSGFndWV0?= Injection-Date: Tue, 02 Jun 2020 09:46:08 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:58931 Date: 2020-06-02T02:46:08-07:00 List-Id: 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;