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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1cc5f4a12c6756c0,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.205.136.10 with SMTP id ii10mr1135717bkc.7.1325025740710; Tue, 27 Dec 2011 14:42:20 -0800 (PST) Path: jh9ni60787bkb.0!nntp.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Access to function causes "access check failed" Date: Wed, 28 Dec 2011 00:42:18 +0200 Organization: Tidorum Ltd Message-ID: <9luvuaF9rcU1@mid.individual.net> References: <32495535.655.1325020811299.JavaMail.geo-discussion-forums@vbls16> Mime-Version: 1.0 X-Trace: individual.net E/dyWwdtkhk3hHjwthSveQQD1kfPxndP5crZxHVQEVNF6zng7b Cancel-Lock: sha1:RJopi//DbaK/v0fZRhTD6BvHE4w= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <32495535.655.1325020811299.JavaMail.geo-discussion-forums@vbls16> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-12-28T00:42:18+02:00 List-Id: On 11-12-27 23:20 , Alex wrote: > Hi everyone! > > I have a question about access to functions. With the example below : > > -- main.adb > with T; > procedure Main is > begin > T.P; > end Main; > > -- t.ads > package T is > type T_Procedure_Params_Access is not null access > function (Request : Integer; > Params : Integer) return Integer; > > procedure P; > private > type T1 is record > I : T_Procedure_Params_Access; > end record; > end T; > > -- t.adb > package body T is > My_T : T1; > procedure P is > begin > null; > end P; > end T; > > The My_T : T1 declaration in t.adb caused the check > failed error on line of "type T1 is record". I wonder why > I have such an error, if it's normal or not. Any ideas ? You have declared T_Procedure_Params_Access as "not null", but the component T1.I is not given an initial value, so the declaration of My_T gives My_T.I the default initial value null, which fails the "not null" constraint. Either remove the "not null" constraint on T_Procedure_Params_Access, or give My_T.I a non-null initial value in some way. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .