comp.lang.ada
 help / color / mirror / Atom feed
From: Jere <jhb.chat@gmail.com>
Subject: Incomplete type generic formal interactions with Implicit_Dereference
Date: Sat, 20 Jan 2018 10:00:36 -0800 (PST)
Date: 2018-01-20T10:00:36-08:00	[thread overview]
Message-ID: <21b6b4fb-4648-419e-ae6c-c361d54eaa2f@googlegroups.com> (raw)

Recently I was working in a generic package that had an Incomplete type
in its specification.  Something like:

generic
   type Some_Type(<>);
   -- ...other stuff
package Some_Package is
   -- stuff
end Some_Package;

In it, I needed to return an access type of the Incomplete type, and I
figured I would just do that through an implicit derefernced object.
I made something like:

type Some_Type_Holder(Ref : not null access Some_Type) is 
   limited null record
with
   Implicit_Dereference => Ref;

At some point it led to a crash in GNAT, which I reported to AdaCore, 
and they said they fixed it in a future rev (side note, do I need to
report that to the FSF team as well and how if so?).  

Recently, I've been wondering if what I tried to do was even meant to 
be legal?  I don't actually use Some_Type_Holder directly in the
package.  It's just a return type of a function for a client to call.

Part of me thinks that since Some_Type is incomplete, that Ada wouldn't
allow for an Implicit_Dereference declared on it.  I guess it depends on
if it is meant to be evaluated in the compilation of the generic itself
or at the point at which the function is called.  

Anyone have any thoughts on this?

             reply	other threads:[~2018-01-20 18:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20 18:00 Jere [this message]
2018-01-20 20:25 ` Incomplete type generic formal interactions with Implicit_Dereference Simon Wright
2018-01-20 22:22   ` Jere
2018-01-21 10:04     ` Simon Wright
2018-01-23 12:42       ` Jere
2018-01-31  1:41   ` Jere
2018-01-31  7:57     ` Simon Wright
2018-01-23  1:08 ` Randy Brukardt
2018-01-23 13:13   ` Jere
2018-01-23 13:20     ` Jere
2018-01-23 16:00     ` Simon Wright
2018-01-25  2:34     ` Randy Brukardt
replies disabled

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