From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=BAYES_40,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:ac8:1e06:: with SMTP id n6mr25323335qtl.365.1634495483567; Sun, 17 Oct 2021 11:31:23 -0700 (PDT) X-Received: by 2002:a05:6902:114a:: with SMTP id p10mr26229303ybu.91.1634495483467; Sun, 17 Oct 2021 11:31:23 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 17 Oct 2021 11:31:23 -0700 (PDT) In-Reply-To: <54181867-ea8d-4fdf-8a5c-dcd167421e79n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=159.250.202.227; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy NNTP-Posting-Host: 159.250.202.227 References: <6c49980a-fe55-4cea-a356-d021b417d942n@googlegroups.com> <54181867-ea8d-4fdf-8a5c-dcd167421e79n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <31fd07c2-f604-4c52-9b72-fd26a12c9cbdn@googlegroups.com> Subject: Re: Is this legal? From: Simon Belmont Injection-Date: Sun, 17 Oct 2021 18:31:23 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:63027 List-Id: 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 a= bout 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.=20 I only ask because there are two rules, one that says the scope of the obje= ct must be *statically* deeper than the return type of the function to be l= egal, 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 n= eeded if it must be done statically). Normally things like that are for ed= ge cases with anonymous access types, so it's not immediately obvious (to m= e, at least) if GNAT is blowing the static check or the dynamic check (Or b= oth? 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 acces= sibility 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 deep= er than that of the master of the call (see 3.10.2).