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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,89c84d29a2e3a1e9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!nntp.abs.net!news.abs.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: generic unit : compilation error ! please help me References: <1140772786.942747.88370@j33g2000cwa.googlegroups.com> From: Stephen Leake Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:SQWDiJlV1PWCV4G08hInhvjqgM8= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 24 Feb 2006 05:51:14 -0500 NNTP-Posting-Host: 66.159.65.1 X-Complaints-To: abuse@toad.net X-Trace: news.abs.net 1140778283 66.159.65.1 (Fri, 24 Feb 2006 05:51:23 EST) NNTP-Posting-Date: Fri, 24 Feb 2006 05:51:23 EST Xref: g2news1.google.com comp.lang.ada:3128 Date: 2006-02-24T05:51:14-05:00 List-Id: nblanpain@hotmail.com writes: > hello, > When i compile the following programm, i have the following error on > function Set_Unit_To_Test of class "child-test_unit.adb" : > "14 : invalid tagged conversion, not compatible with type T_Child'Class > defined at child.ads" > I don't undestand this error : please help me ! > > ## parent.ads ## : minor point; please use Ada comments for separators like this, so gnatchop can handle them. > generic > type T_Real is digits <>; > package Parent is > type T_Parent is tagged private; > type T_Parent_Access is access all T_Parent; > private > type T_Parent is tagged record > Real : T_Real; > end record; > end Parent; I have not fully sorted out your problem, because I find the names too confusing. While it is proper to have similar names like this in a finished product, they do get in the way of finding structural problems. So first, do these steps: 1) Get rid of the subtypes; use the full type names. It will make things clearer. 2) Name things clearly, without relying on the package name; Parent_Class_Access_Type, Child_Class_Access_Type. I think you have too many class-wide access types. In particular, I think you are trying to store a parent unit test in an object of type child unit test. The object probably needs to be of type Parent_Class_Access. The clearer names will help you sort out what you really want to do. Once that is clear, you can change the names back to be more user-friendly. -- -- Stephe