comp.lang.ada
 help / color / mirror / Atom feed
* Are limited interfaces deeper than non-limited ones?
@ 2017-04-09 20:52 Natasha Kerensikova
  2017-04-10 20:59 ` Randy Brukardt
  0 siblings, 1 reply; 2+ messages in thread
From: Natasha Kerensikova @ 2017-04-09 20:52 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-10 20:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-09 20:52 Are limited interfaces deeper than non-limited ones? Natasha Kerensikova
2017-04-10 20:59 ` Randy Brukardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox