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,1d9d69d55b9d5ba7,start X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: generic formal derived type that inherits private op Date: 1999/11/11 Message-ID: <382b8c0b_1@news1.prserv.net>#1/1 X-Deja-AN: 547607826 Content-transfer-encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Complaints-To: abuse@prserv.net X-Trace: 12 Nov 1999 03:39:55 GMT, 32.101.8.180 Organization: Global Network Services - Remote Access Mail & News Services Mime-version: 1.0 Newsgroups: comp.lang.ada Date: 1999-11-11T00:00:00+00:00 List-Id: There's some code below that I think should work, but doesn't: 1) A generic child package imports a generic formal type that derives from a (tagged) type declared in the parent package. 2) The parent type declares a primitive operation privately; that is, in the private region of the parent package. 3) The generic child package tries to call the (private) primitive operation of the derived type, but the compiler doesn't think the derived type comes with that operation. This appears to be incorrect. Here's the output of my compiler (GNAT v3.12p): 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 What's the scoop? Is this correct or not? (Tucker: I submitted this same code to CLA a few months ago. Remember we talked about it at the ARG meeting a few weeks ago?) Thanks, 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;