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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1edf0dd6205794b6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-09 07:27:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: Bug in GNAT? Date: Sat, 9 Nov 2002 09:26:03 -0600 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <3dccc024$0$307$bed64819@news.gradwell.net> <3dcce11d$0$307$bed64819@news.gradwell.net> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1036855623 92262 137.194.161.2 (9 Nov 2002 15:27:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sat, 9 Nov 2002 15:27:03 +0000 (UTC) Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:30650 Date: 2002-11-09T09:26:03-06:00 ----- Original Message ----- From: "Victor Porton" Newsgroups: comp.lang.ada To: Sent: November 09, 2002 4:01 AM Subject: Re: Bug in GNAT? > In article , > Michal Nowak writes: > > > > On 2002-11-09 at 11:56 porton@ex-code.com wrote: > > > >>GNAT-3.14p compiles the following without error-messages. > >>Is it a bug in GNAT or in Ada Standard? > > > > Neither one. > > > >>function F(A: Integer) return Integer is begin return 1; end; > >>Y: Integer renames F(3); > >> > >>Seemingly GNAT parser "thinks" that F(3) is an array element > >>:-) > > > > No, it thinks it is renaming an object. > > See Reference Manual, 8.5.1 Object Renaming Declarations: > > > > 1 An object_renaming_declaration is used to rename an object. > > > > Legality Rules > > 4 The renamed entity shall be an object. > > > > The function F is returning an object of type Integer. > > So, if you invoke F(3) you get an object in result and then > > you rename it to Y. > > Feeling beteer? :-) > > But this compiles with an error: > > function F(A: Integer) return Integer is begin return 1; end; > Y: Integer renames F(3)+2; Renaming declarations (according to the Ada Reference Manual) can only rename a _name_. Thus, since F(3)+2 is not a name, but F(3) is a name, the behavior you are observing is legal. Read the syntax definitions for Renaming_Declarations in 8.5 through 8.5.6, and the definition of Name in 4.1 > > What is the difference? > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada >