comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Access to function causes "access check failed"
Date: Wed, 28 Dec 2011 00:42:18 +0200
Date: 2011-12-28T00:42:18+02:00	[thread overview]
Message-ID: <9luvuaF9rcU1@mid.individual.net> (raw)
In-Reply-To: <32495535.655.1325020811299.JavaMail.geo-discussion-forums@vbls16>

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
       .      @       .



      parent reply	other threads:[~2011-12-27 22:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <32495535.655.1325020811299.JavaMail.geo-discussion-forums@vbls16>
2011-12-27 22:29 ` Access to function causes "access check failed" Robert A Duff
2011-12-27 22:42 ` Niklas Holsti [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox