From: hreba <hreba@terra.com.br>
Subject: Accessibility check failed
Date: Sun, 10 Aug 2014 23:12:37 -0300
Date: 2014-08-10T23:12:37-03:00 [thread overview]
Message-ID: <c4qn4nFbplvU1@mid.individual.net> (raw)
One more beginner's question.
I wrote a linear list of abstract items.
There is an abstract type Iterator with an abstract method Proc which
can be called with a class wide item type. Procedure Iterate calls Proc
with each item of the list.
For a test I declared a concrete extension extension of Gen.Lists.ItemD.
I also declare a concrete extension of Iterator called Writer and a
concrete method Proc.
Everything compiles, but at runtime the line
i:= Item(itm);
in Proc generates a "accessibility check failed" error.
I checked with a debugger that itm is not null and that its actual
(dynamic) type is that of the concrete extension.
So what is wrong?
A more complete extract of my program follows.
---------------------
package Gen.Lists is
type ItemD is abstract tagged private;
type List is limited private;
type Iterator is abstract tagged null record;
procedure Proc (iter: in out Iterator; itm: access ItemD'Class) is
abstract;
procedure Iterate (ic: in out Iterator'Class; l: List);
end Gen.Lists;
--------------------
with Gen.Lists;
package test_lists_aux is
type ItemD is new Gen.Lists.ItemD with
record
ch: Character;
end record;
type Item is access all ItemD;
type Writer is new Gen.Lists.Iterator with null record;
procedure Proc (w: in out Writer; itm: access Gen.Lists.ItemD'Class);
end test_lists_aux;
-----------------
with Ada.Text_IO; use Ada.Text_IO;
package body test_lists_aux is
procedure Proc (w: in out Writer; itm: access Gen.Lists.ItemD'Class) is
i: Item;
begin
if itm.all in ItemD then
i:= Item(itm);
end if;
Put (i.ch);
--Put (Item(itm).ch);
end Proc;
end test_lists_aux;
--
Frank Hrebabetzky +55 / 48 / 3235 1106
Florianopolis, Brazil
next reply other threads:[~2014-08-11 2:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-11 2:12 hreba [this message]
2014-08-11 5:32 ` Accessibility check failed Jeffrey Carter
2014-08-11 16:45 ` hreba
2014-08-11 16:55 ` Jeffrey Carter
2014-08-12 11:57 ` hreba
2014-08-11 19:56 ` sbelmont700
2014-08-11 20:17 ` Jeffrey Carter
2014-08-11 20:28 ` sbelmont700
2014-08-11 21:14 ` Jeffrey Carter
-- strict thread matches above, loose matches on Subject: below --
2015-11-29 18:03 accessibility " Serge Robyns
2015-11-29 18:37 ` Jeffrey R. Carter
2015-11-29 19:00 ` Serge Robyns
2015-11-29 22:32 ` Jeffrey R. Carter
2015-11-29 22:53 ` Serge Robyns
2015-11-30 2:04 ` Jeffrey R. Carter
2015-11-30 23:22 ` Randy Brukardt
2015-12-01 9:38 ` Serge Robyns
2015-11-29 19:15 ` Dmitry A. Kazakov
2015-11-29 22:40 ` Serge Robyns
2015-12-01 20:17 ` sbelmont700
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox