From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Incomplete type generic formal interactions with Implicit_Dereference
Date: Mon, 22 Jan 2018 19:08:57 -0600
Date: 2018-01-22T19:08:57-06:00 [thread overview]
Message-ID: <p461v9$3m6$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 21b6b4fb-4648-419e-ae6c-c361d54eaa2f@googlegroups.com
"Jere" <jhb.chat@gmail.com> wrote in message
news:21b6b4fb-4648-419e-ae6c-c361d54eaa2f@googlegroups.com...
...
> 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?
I don't think we ever considered this case. But I think it is OK.
Specifically, 4.1.5(6/3) says that a generalized reference denotes a view
equivalent to that of a dereference of the reference discriminant of the
reference object. Thus, any Legality Rules that apply to the dereference of
the discriminant apply to the generalized reference as well. For instance,
this includes any accessibility rules (which was an important part of the
design, as the accessibility rules prevent the access value from living
longer than the object containing the access discriminant).
As such, any other Legality Rules, like the ones about incomplete types
would also apply. Specifically, 3.10.1(10/3): "A prefix that denotes an
object shall not be of an incomplete view."
So a use of an Implicit_Dereference wherever the type is incomplete would
usually be illegal (there are a few ways that a dereference of an incomplete
view can be used, mainly to be passed as a parameter to some routine with an
access-to-incomplete parameter). But it would be OK where the type has been
completed (in this case, outside of the generic instantiation, the way you
intended to use this). This sounds like what you intended.
Randy.
next prev parent reply other threads:[~2018-01-23 1:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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