comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: problems with generic package
Date: 29 May 2002 12:34:08 -0400
Date: 2002-05-29T16:41:36+00:00	[thread overview]
Message-ID: <uhekqq5fj.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3CF49A99.1050005@domain.invalid

user@domain.invalid writes:

> error:
> 
> instantiation error
> unconstrained subtype in component declaration
> actual for "Element" must be a definite subtype

The rules on "definite" vs "indefinite" vs "unconstrained" can be
confusing. Without your complete code, I can't tell what the correct
solution might be. See section 12.5.1 in the ARM, or the chapter on
generic formal types in your favorite Ada book. 

In this case, the error message is telling you that the actual type
('node') you are providing to match Element has an unconstrained
component, which makes it an indefinite subtype.

Since you define 'node' as:

type node is tagged null record;

this doesn't make much sense. Please provide the actual code you
compiled, and the complete error message.

One way to let a generic formal type accept an unconstrained subtype
is to add an unknown discriminant (ARM 12.5.1 (28), ARM 3.7 (3)):

generic
    type Element (<>) is private;

package Generic_Set is
...
end package;

But that may not be what you want.
> 
> 
> 
> thanks for any help
> 

-- 
-- Stephe



      parent reply	other threads:[~2002-05-29 16:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-29  9:08 problems with generic package user
2002-05-29 11:21 ` Preben Randhol
2002-05-29 16:34 ` Stephen Leake [this message]
replies disabled

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