From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: Question about generic formal derived types
Date: 1999/03/30
Date: 1999-03-30T00:00:00+00:00 [thread overview]
Message-ID: <uemm6suip.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 7dpgl4$h2j$1@nnrp1.dejanews.com
adam@irvine.com writes:
After adding a spec for Pack4, running this thru ObjectAda 7.1.2 gives
the error:
adam.adb: Error: line 32 col 67 LRM:8.3(26), Illegal to override
declaration in same region, Introducing new declaration anyway
(In instance of generic Pack2 at adam.adb: line 13 col 9)
I believe that answers all your questions :).
-- Stephe
> In this program fragment:
>
> -------------------------------------------------------------------------------
> package Pack1 is
> type Root_Type is tagged record
> Field1 : Integer;
> Field2 : Boolean;
> end record;
> end Pack1;
>
> with Pack1;
> generic
> type Formal_Type is new Pack1.Root_Type with private;
> package Pack2 is
> type New_Type is new Formal_Type with record
> Field3 : Character;
> end record;
> end Pack2;
>
> with Pack1;
> package Pack3 is
> type Root_Type_Extension is new Pack1.Root_Type with record
> Field3 : Float;
> end record;
> end Pack3;
>
> . . .
>
> with Pack2;
> with Pack3;
> package body Pack4 is
>
> package Instantiation is new Pack2 (Pack3.Root_Type_Extension);
>
> procedure Inner is
> X : Character;
> Y : Instantiation.New_Type;
> begin
> X := Y.Field3;
> end Inner;
>
> end Pack4;
>
> -------------------------------------------------------------------------------
>
> I can't believe that a record type can have two components of the same name,
> but it appears that Instantiation.New_Type would have two components named
> Field3.
>
> When Y.Field3 is accessed, which Field3 is meant?
>
> Which language rules in the RM govern this situation?
>
> -- thanks, Adam
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
next prev parent reply other threads:[~1999-03-30 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-30 0:00 Question about generic formal derived types adam
1999-03-30 0:00 ` Stephen Leake [this message]
1999-03-30 0:00 ` adam
1999-03-31 0:00 ` Stephen Leake
1999-03-31 0:00 ` robert_dewar
1999-03-30 0:00 ` Steve Quinlan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox