From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Are limited interfaces deeper than non-limited ones? Date: Mon, 10 Apr 2017 15:59:59 -0500 Organization: JSA Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1491857999 382 24.196.82.226 (10 Apr 2017 20:59:59 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 10 Apr 2017 20:59:59 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:46568 Date: 2017-04-10T15:59:59-05:00 List-Id: 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" 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