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:a05:620a:1a28:: with SMTP id bk40mr6929572qkb.224.1634410818981; Sat, 16 Oct 2021 12:00:18 -0700 (PDT) X-Received: by 2002:a25:81d1:: with SMTP id n17mr21182390ybm.425.1634410818770; Sat, 16 Oct 2021 12:00:18 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.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: Sat, 16 Oct 2021 12:00:18 -0700 (PDT) Injection-Info: google-groups.googlegroups.com; posting-host=159.250.202.227; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy NNTP-Posting-Host: 159.250.202.227 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6c49980a-fe55-4cea-a356-d021b417d942n@googlegroups.com> Subject: Is this legal? From: Simon Belmont Injection-Date: Sat, 16 Oct 2021 19:00:18 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:63024 List-Id: I'm trying to learn the 2012 changes to accessibility rules, e.g. aliased p= arameters, additional dynamics checks, and some eliminated unnecessary type= casts. But I am also aware of the....fluid nature of GNATs correctness of = implementing them, and the following situation seems dubious. In particula= r, when 'current' is an anonymous access type, it compiles without issue, b= ut not when it's a named access type (or when explicitly converted to one).= Does anyone know off hand which is the correct behavior? Thanks -sb procedure Main is subtype str5 is string(1..5); type s5_ptr is access all str5; =20 type T is record current : access str5;=20 --current : s5_ptr; -- "aliased actual has wrong accessibility" foo : aliased str5; end record; =20 function F (y : aliased in out str5) return access str5 is begin return y'Access; end F; =20 =20 procedure P (x : in out T) is begin x.current :=3D F(x.foo); end P; =20 o : T :=3D (current =3D> null, foo =3D> "Hello"); =20 begin P(o); end Main;