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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,45c4e8c210d7ef0d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 16 Feb 2009 14:56:11 +0100 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Another problem with "interface" References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4999707b$0$32674$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 16 Feb 2009 14:56:11 CET NNTP-Posting-Host: 6a0045c5.newsspool2.arcor-online.net X-Trace: DXC=gCTA;LZ0F8k9kIfcjg:0fdA9EHlD;3Ycb4Fo<]lROoRa^YC2XCjHcbi3\UQddR_@Tl;9OJDO8_SKfNSZ1n^B98ija@`ad78g?0j X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3659 Date: 2009-02-16T14:56:11+01:00 List-Id: Dmitry A. Kazakov schrieb: > On Mon, 16 Feb 2009 09:53:59 +0000, Robert_Matthews wrote: > >> In using interface types with GNAT I have encountered another problem. >> Consider the following package: >> >> package Test is >> >> type A_Type is limited interface; >> >> procedure P (A : in out A_Type; D : Integer) is abstract; >> >> protected type New_A_Type is new A_Type >> with >> procedure P (D : Integer); >> -- other subprograms... >> private >> F : Integer; >> end New_A_Type; >> >> function Set_A return New_A_Type; >> >> end Test; >> >> GNAT gives an error for the function Set_A: >> "operation can be dispatching in only one type", >> which leaves me mystified. Am I making another >> dumb mistake? Please help! >> >> The version of GNAT is GNAT GPL 2008 (20080521). > > This looks like a compiler bug to me. The compiler thinks that Set_A is a > protected function of New_A_Type and thus has the hidden argument > New_A_Type and the result New_A_Type, so it complains. But protected type > is not tagged so Set_A cannot be dispatching. Maybe illustrating this point, procedure R is type I is Synchronized Interface; protected type T is new I with function Make_T return I'class; end T; protected body T is function Make_T return I'class is begin return (I with null record); end; end T; X: constant T := T.Make_T; begin null; end; +===========================GNAT BUG DETECTED==============================+ | 4.3.0 20070903 (experimental) [trunk revision 128061] (i686-apple-darwin8) | | Assert_Failure atree.adb:3812 | | Error detected at r.adb:15:22 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html.