From: Michal Nowak <vinnie@inetia.pl>
Subject: Re: Bug in GNAT?
Date: Sat, 09 Nov 2002 10:43:26 +0100
Date: 2002-11-09T10:43:26+01:00 [thread overview]
Message-ID: <mailman.1036834503.25329.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: <3dccc024$0$307$bed64819@news.gradwell.net>
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
--
-- -----------------------------------------------------------------
next prev parent reply other threads:[~2002-11-09 9:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-09 6:56 Bug in GNAT? Victor Porton
2002-11-09 9:43 ` Michal Nowak [this message]
2002-11-09 10:01 ` Victor Porton
2002-11-09 12:26 ` Michal Nowak
2002-11-09 15:26 ` David C. Hoos, Sr.
2002-11-09 15:31 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox