comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Are limited interfaces deeper than non-limited ones?
Date: Mon, 10 Apr 2017 15:59:59 -0500
Date: 2017-04-10T15:59:59-05:00	[thread overview]
Message-ID: <ocgrof$bu$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: slrnoel7u4.1m1.lithiumcat@nat.rebma.instinctive.eu

It looks to me like you've found a GNAT bug. I can't imagine why the 
accessibility of something would be different for a non-limited vs. a 
limited interface.

The rules for the details of instantiations with classwide types are pretty 
weird, so I suspect something has gone wrong in one of those instances.

                                           Randy.

"Natasha Kerensikova" <lithiumcat@instinctive.eu> wrote in message 
news:slrnoel7u4.1m1.lithiumcat@nat.rebma.instinctive.eu...
> 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 



      reply	other threads:[~2017-04-10 20:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-09 20:52 Are limited interfaces deeper than non-limited ones? Natasha Kerensikova
2017-04-10 20:59 ` Randy Brukardt [this message]
replies disabled

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