From: porton@ex-code.com (Victor Porton)
Subject: Re: Bug in GNAT?
Date: Sat, 09 Nov 2002 15:01:47 +0500
Date: 2002-11-09T10:19:09+00:00 [thread overview]
Message-ID: <3dcce11d$0$307$bed64819@news.gradwell.net> (raw)
In-Reply-To: 3dccc024$0$307$bed64819@news.gradwell.net
In article <mailman.1036834503.25329.comp.lang.ada@ada.eu.org>,
Michal Nowak <vinnie@inetia.pl> 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;
What is the difference?
next prev parent reply other threads:[~2002-11-09 10:01 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
2002-11-09 10:01 ` Victor Porton [this message]
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