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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9778ad55d3901071 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!news.uni-stuttgart.de!news.belwue.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: generic child class Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1141728249.709680.183670@v46g2000cwv.googlegroups.com> Date: Tue, 7 Mar 2006 12:31:35 +0100 Message-ID: <12ipez11qyo1y.lkvh9am5ndaa.dlg@40tude.net> NNTP-Posting-Date: 07 Mar 2006 12:31:35 MET NNTP-Posting-Host: 159a3b6c.newsread4.arcor-online.net X-Trace: DXC=lU[c^[7?V5g^O_h>VFi7[b:ejgIfPPlddjW\KbG]kaMhQc4L4[MA2T`aghfC_a7^=a[6LHn;2LCVn7enW;^6ZC`dIXm65S@:3>o X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:3282 Date: 2006-03-07T12:31:35+01:00 List-Id: On 7 Mar 2006 02:44:09 -0800, nblanpain@hotmail.com wrote: > I have a compilation error that i not understand. This is my example : > > ## Vec package ## > generic > type T_Real is digits <>; > package Vec is > end Vec; > > ## Mat package ## > with Vec; > generic > with package Vector is new Vec (<>); > package Mat is > end Mat; > > ## Mat.Child package ## > generic > type T_Tab is array (Integer) of Vector.T_Real; > package Mat.Child is > end Mat.Child; > > ## Test package ## > with Vec; > with Mat; > with Mat.Child; > package Test is > package Vec_Float is new Vec (T_Real => Float); > package Mat_Float is new Mat (Vector => Vec_Float); > type T_Tableau is array (Integer) of Float; > package Mat_Child_Float is new Mat_Float.Child (T_Tab => T_Tableau); > ---- error !!!!!!!!!! > end Test; > > The error message is : > "component subtype of actual does not match that of formal T_Tab " > > have you an explaining ? GNAT has numerous bugs in generics. As for your example, one trick I know works with GNAT 3.15p is: ----------------------------- with Vec; generic with package Vector is new Vec (<>); package Mat is subtype Mat_Float is Vector.T_Real; -- Fake subtype to make "type renaming" end Mat; ------------------------------ generic type T_Tab is array (Integer) of Mat_Float; -- Refers to the "rename" package Mat.Child is end Mat.Child; ----------------------------- with Vec; with Mat; with Mat.Child; package Test is package Vec_Float is new Vec (T_Real => Float); package Mat_Float is new Mat (Vector => Vec_Float); type T_Tableau is array (Integer) of Float; package Mat_Child_Float is new Mat_Float.Child (T_Tab => T_Tableau); -- This should be OK with GNAT 3.15p end Test; Alas, at some point this all tricks stop to work. BTW, one "nice" feature of GNAT is to successfully compile generic specifications and bodies and then, upon instantiation, to report bugs in already compiled specifications and bodies. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de