From: Simon Wright <simon@pushface.org>
Subject: Re: Strange compile-time error with Ada.Containers.Indefinite_Hashed_Maps
Date: Mon, 19 May 2014 14:49:45 +0100
Date: 2014-05-19T14:49:45+01:00 [thread overview]
Message-ID: <lytx8l5152.fsf@pushface.org> (raw)
In-Reply-To: 9d912199-ff00-403f-b6e3-fb9632ec145e@googlegroups.com
mockturtle <framefritti@gmail.com> writes:
> I define the "identifier name" type in a package that is with-ed by
> the package that defines the symbol table. The symbol table is just a
> Indefinite_Hash_Map (indefinite since the descriptor is indefinite).
> When I try to compile the body of the symbol table package I get in
> the .ads the error
>
> instantiation error at a-cihama.adb:1043
> invalid constraint: type has no discriminant
All of GNAT GPL 2013, FSF GCC 4.8.1 and FSF GCC 4.9.0 are happy with
your code.
a-cihama.adb (Ada.Containers.Indefinite_Hashed_Maps) line 1043 is in
Read_Node:
function Read_Node
(Stream : not null access Root_Stream_Type'Class) return Node_Access
is
Node : Node_Access := new Node_Type;
begin
begin
Node.Key := new Key_Type'(Key_Type'Input (Stream)); <<<<<<
and I don't see why GNAT thinks there (should be?) a discriminant there.
Is there a reason why you don't make Name_Type just String? You're
forced to use indefinite hashed maps, so the stored Key is assumed to be
indefinite and will be allocated. (I tried this and the compiler was
happy).
next prev parent reply other threads:[~2014-05-19 13:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 10:10 Strange compile-time error with Ada.Containers.Indefinite_Hashed_Maps mockturtle
2014-05-19 13:49 ` Simon Wright [this message]
2014-05-19 16:00 ` mockturtle
2014-05-19 16:19 ` G.B.
2014-05-19 16:35 ` Simon Wright
2014-05-19 21:27 ` J-P. Rosen
2014-05-20 6:30 ` Simon Wright
2014-05-20 20:47 ` björn lundin
2014-05-21 5:04 ` J-P. Rosen
2014-05-25 18:28 ` björn lundin
2014-05-26 8:53 ` J-P. Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox