comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Why a PROGRAM ERROR?
Date: 1998/12/11
Date: 1998-12-11T00:00:00+00:00	[thread overview]
Message-ID: <m3yaofmpon.fsf@mheaney.ni.net> (raw)
In-Reply-To: 3670178F.8751F9B9@nowhere.com

Rusnak <bogus@nowhere.com> writes:

> I have the following code  in a generic package (or code similar to it
> anyway):
> 
> 
>       Given a tagged type "My_Instance" and a type defined as
> 
>           type My_Class_Object_Type is access all My_Instance'Class;
> 
>     I have a function in the spec/body, defined in the body as
> 
>           function Unpack(The_Object : access My_Instance'Class)
>                                       Core_Text : String)
>          return Command_Object
>          is
>             Return_Value :  Command_Object;
>         begin
>             . . .
>                Command_Object.The_Object :=
> My_Class_Object_Type(The_Object);
>            . . .
>          end Unpack;
> 
> 
>         Any time I try to cast the anonymous access type to
> My_Instance'Class to the type My_Class_Object_Type,
>         a program error is raised.  Why is this the case, why is the
> error not caught at compile time, and how can I resolve
>        the error?  It seems to only occur  when a cast like this one is
> made inside an instantiation of a generic package.
> 
>        Any help is greatly appreciated.


Is it possible that you're following a path that doesn't include a
return statement (because of an internal exception, perhaps)?  If you're
getting Program_Error when you execute a function, that's usually the
reason.





  reply	other threads:[~1998-12-11  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-10  0:00 Why a PROGRAM ERROR? Rusnak
1998-12-11  0:00 ` Matthew Heaney [this message]
1998-12-11  0:00   ` Why a PROGRAM ERROR? A GNAT bug? Rusnak
1998-12-11  0:00     ` dewar
1998-12-14  0:00     ` Why a PROGRAM ERROR? Robert I. Eachus
1998-12-11  0:00   ` dennison
replies disabled

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