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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f773a8c1620f6904 X-Google-Attributes: gid103376,public From: je@bton.ac.uk (John English) Subject: Re: 'Class'Input and abstract types Date: 1996/01/08 Message-ID: #1/1 X-Deja-AN: 134909752 sender: news@bton.ac.uk x-nntp-posting-host: snowwhite references: organization: University of Brighton, UK newsgroups: comp.lang.ada Date: 1996-01-08T00:00:00+00:00 List-Id: 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.