From: woodruff@tanana.llnl.gov (John Woodruff)
Subject: Re: Which compiler is correct?
Date: 1997/06/18
Date: 1997-06-18T00:00:00+00:00 [thread overview]
Message-ID: <ud205z1ifw.fsf@tanana.llnl.gov> (raw)
In-Reply-To: EBz083.9EB@world.std.com
>>>>> "bobduff" == Robert A Duff <bobduff@world.std.com> writes:
In article <EBz083.9EB@world.std.com> bobduff@world.std.com (Robert A Duff) writes:
> In article <33A77C54.5484@bix.com>, Tom Moran <tmoran@bix.com>
> wrote:
>> Compilers G and J accept this code. Compiler O gives the error
>> message indicted in the comment, on said line. Which is correct
>> Ada?
(deletia)
> The rules for this stuff are somewhat arcane. See 3.4 and 7.3.1.
(tacit agreement, followed by a new case:)
Here is another inquiry of the type "which compiler is correct." It is
so similar to the issue Bob answered for Tom that I retain the thread
(and the answer Bob gave is so clear that I imagine that this one will
be equally easy to understand once I know the answer.)
Let me define a package with a tagged private type:
package Parent is
type Obj is tagged private ;
private
type Obj is tagged record
I : Integer ;
end record ;
end Parent ;
The package has just one child that extends the type. Depending on the
specifics of how I derive the new type, I get correct code or code that
evokes an error message that I don't understand:
package Parent.Child is
type Good_Obj is new Parent.Obj with private ;
type Bad_Obj is new Parent.Obj with null record ;
procedure Do_Nothing ; -- just to require body
private
type Good_Obj is new Parent.Obj with null record ;
end ;
One of the compilers (compiler "r") is able to compile the body without
error; the other compiler reports an error in the body when I try to
reference the component of the parent type.
package body Parent.Child is
good : Good_Obj ;
Bad : Bad_Obj ;
procedure Do_Nothing is
begin
null;
end ;
begin
Good.I := 2 ;
Bad.I := 2 ; -- compiler "g" reports error
end ;
According to one compiler the component of type Bad_Obj is an "undefined
selector". I am unable to think of a reason why the body of the child
package can reference the parent's private declaration of Obj for one,
but not for the other derived types.
--
John Woodruff N I F \ ^ /
Lawrence Livermore National Lab =====---- < 0 >
510 422 4661 / v \
next prev parent reply other threads:[~1997-06-18 0:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-06-17 0:00 Which compiler is correct? Tom Moran
1997-06-18 0:00 ` Robert A Duff
1997-06-18 0:00 ` John Woodruff [this message]
1997-06-19 0:00 ` Robert A Duff
1997-06-20 0:00 ` Jon S Anthony
1997-06-21 0:00 ` Robert A Duff
1997-06-26 0:00 ` Jon S Anthony
1997-06-19 0:00 ` Simon Wright
1997-06-20 0:00 ` Jon S Anthony
1997-06-21 0:00 ` Robert A Duff
1997-06-21 0:00 ` Robert A Duff
1997-06-21 0:00 ` Simon Wright
1997-06-23 0:00 ` Mats.Weber
1997-06-24 0:00 ` Jon S Anthony
1997-06-18 0:00 ` Pascal Obry
1997-06-18 0:00 ` Tom Moran
-- strict thread matches above, loose matches on Subject: below --
1996-09-10 0:00 Which compiler is correct?? Robert B. Love
1996-09-10 0:00 ` Robert Dewar
1996-09-11 0:00 ` Robert B. Love
1996-09-10 0:00 ` Robert Dewar
1996-09-11 0:00 ` Robert A Duff
1996-09-12 0:00 ` Ken Cowan
1996-09-12 0:00 ` Ken Cowan
1996-09-13 0:00 ` Jon S Anthony
1996-09-11 0:00 ` Jon S Anthony
1996-09-12 0:00 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox