comp.lang.ada
 help / color / mirror / Atom feed
* Re: 'Class'Input and abstract types
       [not found] <DKKCBA.FK3.0.-s@inmet.camb.inmet.com>
@ 1996-01-08  0:00 ` John English
  0 siblings, 0 replies; only message in thread
From: John English @ 1996-01-08  0:00 UTC (permalink / raw)


stt@blackstone.camb.inmet.com (Tucker Taft) writes:
: John English (je@bton.ac.uk) wrote:
: 
: : I'm trying to use 'Class'Input to read records belonging to a class
: : rooted at an abstract type but Gnat 3.01 tells me that 'Class'Input
: : can't be used with abstract types.  I can't find anything in the LRM
: : which disallows this, and it seems a bit strange since (IMHO) most real
: : class hierarchies will be rooted at an abstract type.  Can anyone
: : shed any light on this?  
: 
: This sounds like a GNAT bug.  However, it is most helpful if you
: include the actual source code compiled and the actual error message.
: Otherwise, it is too easy to make the wrong diagnosis.

OK, here's an illustrative example:

  with Ada.Streams.Stream_IO;
  procedure Classin is
    type X is abstract tagged null record;
		-- I can get this to compile like this:
		-- type X_Base is tagged null record;
		-- type X is abstract new X_Base with null record;
    S : Ada.Streams.Stream_IO.Stream_Access;
    A : X'Class := X'Class'Input (S);
		-- this needs changing to:
		-- A : X'Class := X'Class(X_Base'Class'Input(S));
		-- ugh!
  begin
    null;
  end Classin;

This is obviously a silly example, but it produces the same error as the
real code I'm trying to compile.  I've got it to work (modulo some apparent
bugs in 'Class'Input) using the workaround described in the comments above.

: And of course, if you really believe it is a GNAT bug, your first
: line of questioning should go to report@gnat.com.

I've now sent a copy of this example to them in the hope that they will
tell me whether it *is* a bug, in the absence of any replies to my post
from anyone except Tucker (for which my thanks).

--
-------------------------------------------------------------------------------
John English			| Fudd's first law of opposition:
Dept. of Computing		|    If you push something hard enough, it
University of Brighton		|    *will* fall over.




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-01-08  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <DKKCBA.FK3.0.-s@inmet.camb.inmet.com>
1996-01-08  0:00 ` 'Class'Input and abstract types John English

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