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.224.137.67 with SMTP id v3mr13664419qat.0.1380047803961; Tue, 24 Sep 2013 11:36:43 -0700 (PDT) X-Received: by 10.182.72.131 with SMTP id d3mr77423obv.39.1380047803930; Tue, 24 Sep 2013 11:36:43 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!d5no1774889qap.0!news-out.google.com!9ni111qaf.0!nntp.google.com!d5no1774888qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 24 Sep 2013 11:36:43 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=129.59.203.113; posting-account=7Oy7OQoAAABhVYFOo553Cn1-AaU-bSfl NNTP-Posting-Host: 129.59.203.113 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <58149dd9-990d-415c-a121-bc7a1a69473c@googlegroups.com> Subject: Accessibility Levels and Library-Level Units From: Eryndlia Mavourneen Injection-Date: Tue, 24 Sep 2013 18:36:43 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Original-Bytes: 2851 Xref: number.nntp.dca.giganews.com comp.lang.ada:183440 Date: 2013-09-24T11:36:43-07:00 List-Id: I have a package that defines a single procedure access type: 1. package Accessibility_Level_Def is 2. pragma Pure; 3. type Proc_Type is access procedure (An_Str : String); 4. end Accessibility_Level_Def; I have a main program which references it (and another package): 1. with Ada.Text_IO; use Ada.Text_IO; 2. with Accessibility_Level_Def; use Accessibility_Level_Def; 3. with Accessibility_Level_Implementation; use Accessibility_Level_Implementation; 4. procedure Accessibility_Level_Test is 5. procedure Test (Text : String); 6. procedure Test (Text : String) is 7. begin 8. Put_Line ("in Test"); 9. end Test; 10. 11. The_Proc : Proc_Type; 12. begin 13. The_Proc := Test'Access; 14. Sub (Proc => The_Proc); 15. end Accessibility_Level_Test; Gnat 2012 (on Ubuntu) gives the error on line 13: "Subprogram must not be deeper than access type." I thought I understood accessibility levels, at least, I understood the examples I have found. Yet, this example appears to not have the same issues: 1) All the units -- packages and procedure -- are at library level. 2) The procedure is statically defined and is not going to be deallocated until the program exits. This is very frustrating and would seem to preclude the definition of a procedural access type in a separate definitions package. The Implementation package (defining procedure Sub but not shown) compiles nicely, btw. Is this a problem with Gnat? If not, how can I do what I want to do? The attribute Unchecked_Access is not available for subprogram access types. -- Eryndlia (KK1T)