From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1ef593126ef45087 X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Generic children, instances and visibility... Date: 1997/04/09 Message-ID: <334BA5F2.4111@gsfc.nasa.gov>#1/1 X-Deja-AN: 231815619 References: Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Reply-To: Stephen.Leake@gsfc.nasa.gov Newsgroups: comp.lang.ada Date: 1997-04-09T00:00:00+00:00 List-Id: Jon asks about visibility into a private type within a generic body. I constructed a compilable example: package Parent is type T is abstract tagged limited private; private type T is abstract tagged limited record F : Integer; end record; end Parent; generic type Nt is new T with private; package Parent.Child is procedure Foo (Object : in out Nt); end Parent.Child; package body Parent.Child is procedure Foo (Object : in out Nt) is begin Object.F := 1; end Foo; end Parent.Child; Jon then tries to instantiate this in two ways: with Parent.Child; with Inst_Types; procedure test is package PC_Inst is new Parent.Child (Inst_Types.It); begin null; end test; with Parent.Child; with Inst_Types; package Parent.PC_Inst is new Parent.Child (Inst_Types.It); gnat says neither case allows visibility: gnatmake test.adb gcc -c test.adb test.adb:4:04: instantiation error at parent-child.adb:4 test.adb:4:04: undefined selector for type "It" defined at inst_types.ads:3 gnatmake: "test.adb" compilation error gnatmake parent-pc_inst.ads gcc -c parent-pc_inst.ads parent-pc_inst.ads:3:01: instantiation error at parent-child.adb:4 parent-pc_inst.ads:3:01: undefined selector for type "It" defined at inst_types.ads:3 gnatmake: "parent-pc_inst.ads" compilation error So, hoping that a private child would have visibility, I tried a third variation: with Parent.Child; with Inst_Types; private package Parent.Test is type It is new Parent.T with null record; package PC_Inst is new Parent.Child (Inst_Types.It); end Parent.Test; It would seem that no generic can see inside type It; it is a limited private type, period. -- - Stephe