From: Eryndlia Mavourneen <eryndlia@gmail.com>
Subject: Accessibility Levels and Library-Level Units
Date: Tue, 24 Sep 2013 11:36:43 -0700 (PDT)
Date: 2013-09-24T11:36:43-07:00 [thread overview]
Message-ID: <58149dd9-990d-415c-a121-bc7a1a69473c@googlegroups.com> (raw)
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)
next reply other threads:[~2013-09-24 18:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-24 18:36 Eryndlia Mavourneen [this message]
2013-09-24 18:54 ` Accessibility Levels and Library-Level Units Eryndlia Mavourneen
2013-09-24 19:23 ` Adam Beneschan
2013-09-24 19:06 ` mockturtle
2013-09-25 7:46 ` Dmitry A. Kazakov
2013-09-24 19:13 ` mockturtle
2013-09-24 19:23 ` Eryndlia Mavourneen
2013-09-24 19:27 ` Adam Beneschan
2013-09-24 20:02 ` J-P. Rosen
2013-09-24 20:17 ` Eryndlia Mavourneen
2013-09-24 20:32 ` Adam Beneschan
2013-09-24 19:31 ` Jeffrey Carter
2013-09-24 19:43 ` Eryndlia Mavourneen
2013-09-24 19:59 ` Adam Beneschan
2013-09-24 20:50 ` Robert A Duff
2013-09-25 14:40 ` Eryndlia Mavourneen
2013-09-25 21:34 ` Robert A Duff
2013-09-26 12:46 ` Eryndlia Mavourneen
2013-09-29 21:36 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox