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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f19adc1c782ed4a3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail From: "Arthur Schwarz" Newsgroups: comp.lang.ada References: Subject: Ptr Problem Question X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: <6Aa7d.465487$OB3.325741@bgtnsc05-news.ops.worldnet.att.net> Date: Fri, 01 Oct 2004 10:46:26 GMT NNTP-Posting-Host: 12.72.61.212 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1096627586 12.72.61.212 (Fri, 01 Oct 2004 10:46:26 GMT) NNTP-Posting-Date: Fri, 01 Oct 2004 10:46:26 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:4500 Date: 2004-10-01T10:46:26+00:00 List-Id: Each Ptr assignment below yields the following error message: -- 9. Ptr : a.X_Ptr := Object'Access; -- >>> non-local pointer cannot point to local object In the past, the only way that I seem to be able to fix the problem is to put the pointer and assignment in global space (either in file global or in a package spec). I've looked at Ada as a Second Language (Cohen) and, with less diligence, at the Ada LRM but can't figure what I'm doing wrong. What am I doing wrong? art ----------------------------------------------------------- ----------------------------------------------------------- package a is type X is new Integer; type X_Ptr is access all X; end a; -------------------------------------------------------- with a; Procedure b is subtype Y is a.X; subtype Y_Ptr is a.X_Ptr; Object : aliased a.X; Object_Y: aliased Y; Ptr : a.X_Ptr := Object'Access; Ptr_Y : Y_Ptr := Object'Access; Ptr_OY : a.X_Ptr := Object'Access; Ptr_1Y : Y_Ptr := Object'Access; begin -- b Ptr := Object'Access; Ptr_Y := Object'Access; end b;