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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,257e0f74d1a1dfa6,start X-Google-Attributes: gid103376,public From: cosc19z5@Bayou.UH.EDU (Spasmo) Subject: Gnat3.05 Compile Error Msg Date: 1996/08/20 Message-ID: <4vbuvu$jh5@Masala.CC.UH.EDU>#1/1 X-Deja-AN: 175272833 organization: University of Houston newsgroups: comp.lang.ada Date: 1996-08-20T00:00:00+00:00 List-Id: Hey all. I'm getting an error message that's baffling me. Here's what I'm doing and the error: I'm trying to return an access to a member of a record via a function. Here's the pertinent code : type Int_Ptr is access all Integer; type Rec is record A : String(1 .. 10); B : aliased Integer; end record; function Get_Int_Ptr ( R : in Rec ) return Int_Ptr is begin return R.B'Access; end Get_Int_Ptr; When I tried compiling this under Gnat3.05 for DOS the line with the return statement was flagged as an error and I got the following message: "object has deeper accessibility level than access type" Now I originally assumed it had something to do with returning a reference out of the context of a certain scope into the context of a greater scope which made Ada "think" that there was the possibility of a dangling reference in the works, but then I tried turning it into a procedure and passing the "pointer" to it and performing the assignment and I got the same error. Does this have something to do with the "pointer" being embedded in a record? I vaguely remember doing something similar, but with a non-aggregate (access X in parameter) and it worked fine so I'm assuming being in a record incurred extra complications. In any case is there a way I can do what I want to do (return an access (for aliasing) to a record field)? Thanks in advance. -- Spasmo "Everyone has secrets, but sometimes you get caught, So if it's just between us, my silence can be bought" "Blackmail" by Sloppy Seconds