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 01:35:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: Michal Nowak Newsgroups: comp.lang.ada Subject: Re: Bug in GNAT? Date: Sat, 09 Nov 2002 10:43:26 +0100 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <3dccc024$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=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: avanie.enst.fr 1036834503 91409 137.194.161.2 (9 Nov 2002 09:35:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sat, 9 Nov 2002 09:35:03 +0000 (UTC) Return-Path: In-reply-to: <3dccc024$0$307$bed64819@news.gradwell.net> X-Mailer: Calypso Version 3.30.00.00 (3) 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 X-Reply-To: vinnie@inetia.pl 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:30628 Date: 2002-11-09T10:43:26+01:00 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? :-) Michal -- ----------------------------------------------------------------- -- ___ _ -- / _ \ | | I Choose Ada: -- | |_| | ___| | _____ The Most Trusted Name in Software (TM) -- | _ | | __ | | __ | -- |_| |_| |_____|_ |_____|_ http://www.adaic.org/whyada/choose.html -- -- -----------------------------------------------------------------