home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sequent!ogicse!uwm.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!think.com!linus!linus.mitre.org!mbunix.mitre.org!costello
- From: costello@mbunix.mitre.org (Costello)
- Newsgroups: comp.lang.ada
- Subject: Instantiating a Generic Pkg with a Variant Rcd
- Message-ID: <1992Aug14.174855.6049@linus.mitre.org>
- Date: 14 Aug 92 17:48:55 GMT
- Article-I.D.: linus.1992Aug14.174855.6049
- Sender: news@linus.mitre.org (News Service)
- Distribution: usa
- Organization: The MITRE Corp., Bedford, Ma.
- Lines: 37
- Nntp-Posting-Host: mbunix.mitre.org
-
- Hi folks,
- I have the following situation:
-
- (1) I have a generic (list handling) package
- (2) I want to instantiate it with a variant record
-
- eg. generic
- type Element_Type is private;
- Package Linked_List_Handler is
- ...
-
- I want to instantiate this with the type:
- type Variant_Rcd (c : discr_type) is record
- ...
- case c is
- ...
- end case;
- end record;
-
- When I compile this I get the error:
-
- >>>>SEMANTIC : Constrained subtype required <3.6.1:6>
-
- I'm afraid that the LRM pages weren't very helpful (to me anyway).
- Does this mean error that I cannot instantiate a generic pkg with
- a variant record? Note: when I put a default value with the
- discriminant in the variant record (i.e. c : discr_type := init_value)
- then it compiles fine, but from testing it appears that the
- generic pkg is working with the record that has c = init_value, and
- is not variable (i.e. not really variant). Could someone please
- explain the finer points of generic pks with variant records?
-
- Please mail responses directly to me at:
-
- costello@mitre.org
-
- Thanks. /Roger
-