comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephe_on_the_web@toadmail.com>
Subject: Re: generic unit : compilation error ! please help me
Date: Fri, 24 Feb 2006 05:51:14 -0500
Date: 2006-02-24T05:51:14-05:00	[thread overview]
Message-ID: <u7j7lqbbx.fsf@toadmail.com> (raw)
In-Reply-To: 1140772786.942747.88370@j33g2000cwa.googlegroups.com

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



       reply	other threads:[~2006-02-24 10:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1140772786.942747.88370@j33g2000cwa.googlegroups.com>
2006-02-24 10:51 ` Stephen Leake [this message]
2006-02-24 10:51 ` generic unit : compilation error ! please help me Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox