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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f19ed823014e9b9a X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: generic formal object of class-wide type Date: 1999/04/29 Message-ID: #1/1 X-Deja-AN: 472341381 References: <7g9kga$dl1@hobbes.crc.com> NNTP-Posting-Date: Thu, 29 Apr 1999 09:05:28 PDT Newsgroups: comp.lang.ada Date: 1999-04-29T00:00:00+00:00 List-Id: "David C. Hoos, Sr." writes: > Matthew Heaney wrote in message ... > >When I try to compile package Q (see below), I get this error: > > > >q.ads:3:25: type of actual does not match type of "O" > > > >Why? > > > The actual needs to be explicitly converted to the type of the > formal, like so: > > package Q is new GQ (P.T'Class (P.C.O)); Yes, but why? If I have a subprogram with a parameter of a class-wide type, like this: procedure Op (O : T'Class); and NT is a type in T'Class, then I can do this: declare O : NT; begin Op (O); end; No conversion to type T'Class is required in order to call Op. It is inconsistent that a type conversion is required in order pass the object as a generic actual. I'd like to know the specific rule, and a rationale for the inconsistency.