From: Jere <jhb.chat@gmail.com>
Subject: Re: changing rules for anonymous access types to named ones
Date: Mon, 2 Apr 2018 11:04:46 -0700 (PDT)
Date: 2018-04-02T11:04:46-07:00 [thread overview]
Message-ID: <e76bfb2c-7137-4e86-b91d-bb914b3e2446@googlegroups.com> (raw)
In-Reply-To: <b2039dba-c5b9-4bf1-a589-bf055c713621@googlegroups.com>
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;
next prev parent reply other threads:[~2018-04-02 18:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 16:39 changing rules for anonymous access types to named ones Jean-Claude Rostaing
2018-04-02 18:04 ` Jere [this message]
2018-04-02 21:09 ` Jean-Claude Rostaing
2018-04-03 8:41 ` Dmitry A. Kazakov
2018-04-03 11:29 ` Jean-Claude Rostaing
2018-04-03 12:44 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox