From: Serge Robyns <serge.robyns@gmail.com>
Subject: accessibility check failed
Date: Sun, 29 Nov 2015 10:03:25 -0800 (PST)
Date: 2015-11-29T10:03:25-08:00 [thread overview]
Message-ID: <3d45e3ed-16ca-4018-bf7b-62830acaca03@googlegroups.com> (raw)
I'm facing a "mysterious" accessibility check failed error.
I'm having the following function:
overriding function Get_Client
(Self : not null access T_Data_Store;
Client_Name : in T_Client_Name)
return T_Client'Class
is
Cursor : Client_Map.Cursor;
begin
Cursor := Self.Clients.Find (Client_Name);
if Cursor = Client_Map.No_Element then
return T_Client_DAO'(No_Client
with Store => Self);
end if;
return T_Client_DAO'(T_Client (Client_Map.Element (Cursor))
with Store => Self);
end Get_Client;
The definition of T_Client_DAO is:
type T_Client_DAO is new T_Client with record
Store : access T_Abstract_Data_Store'Class;
end record;
T_Client is the object with is methods. T_Abstract_Data_Store is the assembly of Factory interfaces (see below for an example).
The idea is to return a copy of the client record and store with it a reference to the data store class from which the object came from. This will allow to use my_object.change_XYZ to update the object and it's representation into the store through that reference.
Researching the web for the accessibility check failed all refers to returning a reference to a local variable which is indeed disappearing on the execution of the return statement. But in my case, I'm just storing the reference I did receive from the parent.
I did find a suggestion to replace anonymous access types to named ones but that does not compile for the interface class for which the above function is an implementation.
type Factory is limited interface;
type Factory_Access is access Factory;
function Get_Client
(Self : Factory_Access;
Client_Name : in T_Instrument_Name)
return T_Client'Class
is abstract;
with:
warning: abstract subprogram is not dispatching or overriding
However when using not null access T_Factory instead it does compile.
next reply other threads:[~2015-11-29 18:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-29 18:03 Serge Robyns [this message]
2015-11-29 18:37 ` accessibility check failed 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
-- strict thread matches above, loose matches on Subject: below --
2014-08-11 2:12 Accessibility " hreba
2014-08-11 5:32 ` 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox