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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.249.73 with SMTP id ys9mr811141pac.9.1407863017976; Tue, 12 Aug 2014 10:03:37 -0700 (PDT) X-Received: by 10.140.83.163 with SMTP id j32mr25115qgd.33.1407863017901; Tue, 12 Aug 2014 10:03:37 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h18no18959614igc.0!news-out.google.com!j6ni43193qas.0!nntp.google.com!v10no6514488qac.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 12 Aug 2014 10:03:37 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.1.127.241; posting-account=L2-UcQkAAAAfd_BqbeNHs3XeM0jTXloS NNTP-Posting-Host: 94.1.127.241 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3854a5ec-f49a-4c81-916b-e8cf750dc2ad@googlegroups.com> Subject: Accessibility check failure with Implicit_Dereference aspect From: Lucretia Injection-Date: Tue, 12 Aug 2014 17:03:37 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:21685 Date: 2014-08-12T10:03:37-07:00 List-Id: Hi, I've tried this a number of times and still cannot get this thing to work like the documentation (Barnes, Gem's, etc.) say that it's supposed to unless I'm missing something. I have this: generic type T is new Quicksilver.Containers.Counted_Items.Counted_Item with private; package Quicksilver.Containers.Smart_Pointers is type Access_T is access all T; -- Provide an accessor for the counted item that we can return from functions. type Reference (Element : not null access T) is limited private with Implicit_Dereference => Element; -- TODO: Place inside a generic package to constrain the type? type Smart_Pointer is new Ada.Finalization.Controlled with private; ... not overriding function Get (Self : in Smart_Pointer) return Reference; ... end Quicksilver.Containers.Smart_Pointers; On compiling a test, I get the following warnings: Compiling: /home/laguest/src/mine/sterling-os/quicksilver/unit_tests/test_suite-smart_pointer_tests.adb Source file time stamp: 2014-08-12 15:21:32 Compiled at: 2014-08-12 17:59:55 ==============Error messages for source file: /home/laguest/src/mine/sterling-os/quicksilver/unit_tests/test_suite-smart_pointer_tests.ads 46. package Datum_Smart_Pointers is new Quicksilver.Containers.Smart_Pointers (T => Datum); | >>> warning: in instantiation at quicksilver-containers-smart_pointers.adb:50 >>> warning: accessibility check failure >>> warning: "Program_Error" will be raised at run time >>> warning: in instantiation at quicksilver-containers-smart_pointers.adb:67 >>> warning: accessibility check failure >>> warning: "Program_Error" will be raised at run time 74 lines: No errors, 6 warnings and the line it's complaining about at line 50 is: not overriding function Get (Self : in Smart_Pointer) return Reference is begin -- Keep a copy of the smart pointer inside the reference to stop it from being deallocated. return Reference'(Element => Self.Data, Hold => Self); end Get; Specifically the "Element => Self.Data" part. Has anyone managed to do this? I've tried with latest GCC trunk, GNAT 4.10.0 20140807 (experimental) and GNAT GPL 2014 and get the same issues. Is this a compiler issue or me? Thanks, Luke A. Guest.