comp.lang.ada
 help / color / mirror / Atom feed
* Incomplete type generic formal interactions with Implicit_Dereference
@ 2018-01-20 18:00 Jere
  2018-01-20 20:25 ` Simon Wright
  2018-01-23  1:08 ` Randy Brukardt
  0 siblings, 2 replies; 12+ messages in thread
From: Jere @ 2018-01-20 18:00 UTC (permalink / 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?

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-01-31  7:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-20 18:00 Incomplete type generic formal interactions with Implicit_Dereference Jere
2018-01-20 20:25 ` 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

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