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: a07f3367d7,1449b098788729b8 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.velia.net!weretis.net!feeder2.news.weretis.net!de-l.enfer-du-nord.net!gegeweb.org!aioe.org!nospam From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: prefix of dereference must be a name? Date: Thu, 30 Jul 2009 15:35:02 -0400 Organization: The Wasteland Message-ID: References: NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.7.9 Cancel-Lock: sha1:w1YVGsJCE4+hHDaE1V0oa1hyt1g= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news2.google.com comp.lang.ada:7463 Date: 2009-07-30T15:35:02-04:00 List-Id: In article , Stephen Leake wrote: > I'd like to be able to do the following: > > type T is record ... end record; > type T_Access is access all T; > > function "+" (Left, Right in : ...) return T_Access; > > A : T_Access := new T; > B : T_Access := new T; > C : T_Access := A + B; > > A.all := (C + B).all; > > but GNAT complains that "prefix for selection is not a name", pointing > to (C + B).all. > > So then I tried: > > function "-" (Token : in T_Access) return T_Access > is begin > return Token; > end; > > A.all := -(C + B).all; > > and got the same error. Finally I tried: > > function Copy (Token : in T_Access) return T_Access > is begin > return Token; > end; > > A.all := Copy (C + B).all; > > And the compiler was happy. Interesting. The compiler was happy with a function call: A.all := "+"(C, B).all; but a use_type_clause didn't seem to help. > What's the rationale for this? > > I assume one issue here is that "-" might be an intrinsic, but since > the type involved is not a numeric type, I don't see how that could be > a problem. > > Similarly for ().all; when could that be a problem? -- John B. Matthews trashgod at gmail dot com