comp.lang.ada
 help / color / mirror / Atom feed
From: Jean-Claude Rostaing <00120260a@gmail.com>
Subject: changing rules for anonymous access types to named ones
Date: Mon, 2 Apr 2018 09:39:36 -0700 (PDT)
Date: 2018-04-02T09:39:36-07:00	[thread overview]
Message-ID: <b2039dba-c5b9-4bf1-a589-bf055c713621@googlegroups.com> (raw)

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.

             reply	other threads:[~2018-04-02 16:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 16:39 Jean-Claude Rostaing [this message]
2018-04-02 18:04 ` changing rules for anonymous access types to named ones Jere
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