comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Belmont <sbelmont700@gmail.com>
Subject: Re: Is this legal?
Date: Sun, 17 Oct 2021 11:31:23 -0700 (PDT)	[thread overview]
Message-ID: <31fd07c2-f604-4c52-9b72-fd26a12c9cbdn@googlegroups.com> (raw)
In-Reply-To: <54181867-ea8d-4fdf-8a5c-dcd167421e79n@googlegroups.com>

On Sunday, October 17, 2021 at 4:41:17 AM UTC-4, AdaMagica wrote:

> The accessibility rules are far too complicated and unreadable (I'm not about trying to grock them), but the component current has a type that has a lifetime as long as Main. Your object o may be declared in an inner scope with less lifetime. Thus the assignment must be illegal. 

I only ask because there are two rules, one that says the scope of the object must be *statically* deeper than the return type of the function to be legal, but then another similar one down the page that says a runtime check is made to ensure it (which begs the question of why the runtime check is needed if it must be done statically).  Normally things like that are for edge cases with anonymous access types, so it's not immediately obvious (to me, at least) if GNAT is blowing the static check or the dynamic check (Or both?  Or neither?)

6.4.1~6.3/3
  In a function call, the accessibility level of the actual object for each explicitly aliased parameter shall not be statically deeper than the accessibility level of the master of the call (see 3.10.2).

6.4.1~15.1/3
In a function call, for each explicitly aliased parameter, a check is made that the accessibility level of the master of the actual object is not deeper than that of the master of the call (see 3.10.2).

  reply	other threads:[~2021-10-17 18:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-16 19:00 Is this legal? Simon Belmont
2021-10-17  8:35 ` Gautier write-only address
2021-10-17  8:41 ` AdaMagica
2021-10-17 18:31   ` Simon Belmont [this message]
2021-10-18 10:50     ` AdaMagica
2021-10-19  3:50 ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
1991-11-09 18:02 Is this legal ? Bud Bach
1991-11-09  3:20 Robert I. Eachus
1991-11-08 20:58 Boris Pelakh
replies disabled

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