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.13.241.132 with SMTP id a126mr53446666ywf.2.1448820206194; Sun, 29 Nov 2015 10:03:26 -0800 (PST) X-Received: by 10.182.247.67 with SMTP id yc3mr599574obc.0.1448820206161; Sun, 29 Nov 2015 10:03:26 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!b51no4345878qgf.0!news-out.google.com!f6ni14409igq.0!nntp.google.com!mv3no5663305igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 29 Nov 2015 10:03:25 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=109.88.54.35; posting-account=6m7axgkAAADBKh082FfZLdYsJ24CXYi5 NNTP-Posting-Host: 109.88.54.35 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3d45e3ed-16ca-4018-bf7b-62830acaca03@googlegroups.com> Subject: accessibility check failed From: Serge Robyns Injection-Date: Sun, 29 Nov 2015 18:03:26 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28593 Date: 2015-11-29T10:03:25-08:00 List-Id: 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 :=3D Self.Clients.Find (Client_Name); if Cursor =3D Client_Map.No_Element then return T_Client_DAO'(No_Client with Store =3D> Self); end if; return T_Client_DAO'(T_Client (Client_Map.Element (Cursor)) with Store =3D> 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 assem= bly of Factory interfaces (see below for an example). The idea is to return a copy of the client record and store with it a refer= ence to the data store class from which the object came from. This will al= low to use my_object.change_XYZ to update the object and it's representatio= n into the store through that reference. Researching the web for the accessibility check failed all refers to return= ing a reference to a local variable which is indeed disappearing on the exe= cution of the return statement. But in my case, I'm just storing the refer= ence 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. =20 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.