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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a3ca673ce44576,start X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Cannot call primitive op for generic formal derived type: why not? Date: 1999/09/02 Message-ID: <37cf2237@news1.us.ibm.net>#1/1 X-Deja-AN: 520421761 Content-transfer-encoding: 7bit X-Trace: 3 Sep 1999 01:19:51 GMT, 32.101.8.89 Organization: Global Network Services - Remote Access Mail & News Services X-Notice: should be reported to postmaster@ibm.net Content-Type: text/plain; charset="US-ASCII" Mime-version: 1.0 Newsgroups: comp.lang.ada X-Complaints-To: postmaster@ibm.net Date: 1999-09-02T00:00:00+00:00 List-Id: I have a type hierarchy, rooted at P.T, with a private, primitive operation, here called Private_Op. The root package P has a generic child, P.C, with a generic formal type that derives from T, here called NT. P.C has a public operation, Op, that takes NT as an access parameter. The body of P.C.Op tries to call the primitive operation Private_Op. This seems like it should be legal, because NT derives from T, and T has Private_Op as a primitive operation (so NT should have inherited it). Yet my compiler is telling me that the call to Private_Op is illegal: p-c.adb:5:19: expected type access to "T" defined at p.ads:9 p-c.adb:5:19: found type access to "Nt" defined at p-c.ads:5 It seems as if the compiler doesn't acknowledge that Private_Op is primitive for NT. What's up with that? Is this a compiler bug, or is this program not legal Ada? I thought the whole point of importing a derived type is precisely to be able to call the primitive operations for types in that class. Is this expectation incorrect? Thanks in advance, Matt --STX package P is type T is abstract tagged limited private; private type T is abstract tagged limited null record; procedure Private_Op (O : access T); end P; package body P is procedure Private_Op (O : access T) is begin null; end; end P; generic type NT is new T with private; package P.C is procedure Op (O : access NT); end P.C; package body P.C is procedure Op (O : access NT) is begin Private_Op (O); end Op; end P.C;