From: Natasha Kerensikova <lithiumcat@instinctive.eu>
Subject: Are limited interfaces deeper than non-limited ones?
Date: Sun, 9 Apr 2017 20:52:28 -0000 (UTC)
Date: 2017-04-09T20:52:28+00:00 [thread overview]
Message-ID: <slrnoel7u4.1m1.lithiumcat@nat.rebma.instinctive.eu> (raw)
Hello,
I know that accessibility levels come with a host of problems, but I
thought that static accessibility was reasonably well understood, and
yet I encounter this very strage situation. Everything else being
otherwise equal, everything works fine with a non-limited interface, but
GNAT FSF v6.3.1 rejects the limited interface.
Is there something wrong with my GNAT or is there really something I
miss going on here?
Thanks in advance for your help,
Natasha
----- mini.ads ------
generic
type Held_Data (<>) is limited private;
package Mini is
type Holder is private;
function Create
(Constructor : not null access function return Held_Data)
return Holder;
private
type Data_Access is access Held_Data;
type Holder is record
Ref : Data_Access;
end record;
end Mini;
----- mini.adb ------
package body Mini is
function Create
(Constructor : not null access function return Held_Data)
return Holder is
begin
return (Ref => new Held_Data'(Constructor.all));
end Create;
end Mini;
----- non_lim.ads ------
with Mini;
package Non_Lim is
type Data is interface;
package Instance is new Mini (Data'Class);
end Non_Lim;
----- lim.ads ------
with Mini;
package Lim is
type Data is limited interface;
package Instance is new Mini (Data'Class);
end Lim;
----- GNAT output ------
$ gnatmake non_lim.ads
ada -c non_lim.ads
ada -c mini.adb
$ gnatmake lim.ads
ada -c lim.ads
lim.ads:7:04: warning: in instantiation at mini.adb:7
lim.ads:7:04: warning: accessibility check failure
lim.ads:7:04: warning: "Program_Error" will be raised at run time
next reply other threads:[~2017-04-09 20:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-09 20:52 Natasha Kerensikova [this message]
2017-04-10 20:59 ` Are limited interfaces deeper than non-limited ones? Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox