From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Formal Subprogram Access Date: Tue, 13 Feb 2018 18:34:33 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 13 Feb 2018 17:34:34 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="26ddbe365de3b03fa96a7ed29ac5ba12"; logging-data="32122"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/cEMNsE8a7kMfn29qnS5a4WeLRf5udb5A=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 In-Reply-To: Content-Language: en-US Cancel-Lock: sha1:j3h6Rsw8AqsfHi1ArSwjE6K+Bso= Xref: reader02.eternal-september.org comp.lang.ada:50422 Date: 2018-02-13T18:34:33+01:00 List-Id: On 02/13/2018 06:51 AM, Randy Brukardt wrote: > > There's no such rule in the RM. As Christoph noted, a generic formal > subprogram has convention Ada, 'Access is allowed. If you pass an attribute > to it, you have to wrap it in a real subprogram for this reason. (There is a > lot of code specifically to do this in Janus/Ada, it probably never has been > tested outside of a single ACATS test -- I don't think anyone ever has had a > reason to pass an attribute like Succ as a formal subprogram.) 6.3.1(9) says an attribute subprogram is Intrinsic 6.3.1(11) say you can't apply 'Access to an Intrinsic subprogram 12.6 (14) says a generic formal subprogram may be matched by an attribute function 12.6(16.2) say a generic formal subprogram with "is null" for the default, not matched by an explicit actual, is Intrinsic. Since a formal subprogram may be instantiated with an Intrinsic actual, a generic should not be allowed to take 'Access of a formal subprogram. > If you rename such an attribute, however, the convention stays the same, so > 'Access isn't allowed then. But renaaming a formal subprogram certainly > shouldn't change whether or not 'Access is allowed. The only restriction I can see on renaming an Intrinsic subprogram deals with renaming-as-body, which doesn't apply here, so the renaming seems legal. However, as the convention of the renaming may also be Intrinsic, it seems a generic should be allowed to take 'Access of a renaming of a formal subprogram. > As I said, file a bug report. Even if I'm wrong about the legality of > 'Access on a formal subprogram, the renames should work the same way. GNAT does instantiation as macro expansion. Might that have any effect on how these rules apply or when a violation is detected? -- Jeff Carter "If you don't get the President of the United States on that phone, ... you're going to have to answer to the Coca-Cola Company." Dr. Strangelove 32