From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Bug in GNAT?
Date: Sat, 9 Nov 2002 09:26:03 -0600
Date: 2002-11-09T09:26:03-06:00 [thread overview]
Message-ID: <mailman.1036855622.7355.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 3dcce11d$0$307$bed64819@news.gradwell.net
----- Original Message -----
From: "Victor Porton" <porton@ex-code.com>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: November 09, 2002 4:01 AM
Subject: Re: Bug in GNAT?
> 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;
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
>
next prev parent reply other threads:[~2002-11-09 15:26 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
2002-11-09 12:26 ` Michal Nowak
2002-11-09 15:26 ` David C. Hoos, Sr. [this message]
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