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,FREEMAIL_FROM, WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.138.37 with SMTP id m37mr4989043iod.90.1522692286762; Mon, 02 Apr 2018 11:04:46 -0700 (PDT) X-Received: by 2002:a9d:1f58:: with SMTP id x24-v6mr606720otx.9.1522692286578; Mon, 02 Apr 2018 11:04:46 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!u184-v6no4241174ita.0!news-out.google.com!d3-v6ni2277itf.0!nntp.google.com!k65-v6no2444408ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 2 Apr 2018 11:04:46 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.218.250; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.218.250 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: changing rules for anonymous access types to named ones From: Jere Injection-Date: Mon, 02 Apr 2018 18:04:46 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:51298 Date: 2018-04-02T11:04:46-07:00 List-Id: On Monday, April 2, 2018 at 12:39:38 PM UTC-4, Jean-Claude Rostaing wrote: > Hi. > There's definitely a change in rules from 95 to 2012 I spotted, which makes things more ugly: > that: Set(new Plus_Operator); > was written for ada95. Now, it gives the error: > expected type "TOKEN_ACCESS" defined at expressions.ads:22 > found type access to "Plus_Operator" defined at line 48 > TOKEN_ACCESS is merely a named access type to TOKEN_TYPE'class, which PLUS_OPERATOR is a child of. > > I made a compilable exemple of my case: > > with ada.Text_IO; > use ada.Text_IO; > procedure ESSAI is > type A is abstract tagged limited null record; > type A_Child is new A with null record; > type pointers_A is access A'CLASS; > type B is interface; > type B_child is new B with null record; > type pointers_B is access b'CLASS; > function F1 (obj: pointers_A) return INTEGER is (1); > function F2 (obj: pointers_b) return INTEGER IS (1); > begin > PUT_LINE("avec abstract tagged null record : " & INTEGER'IMAGE(F1(new A_child)); > Put_Line("AVEC interface : " & INTEGER'IMAGE(F2(new B_child)); > end; > > Only the second statement fails. I could find nothing in the access type section related to interface nor the reciprocal so I'm sure it's not normal. I don't think interfaces were part of 95 and they may have different rules versus an abstract record. However, you can change your access type to a general access type to solve the compilation error: type pointers_B is access all b'CLASS;