Version 1.4 of ai05s/ai05-0253-1.txt

Unformatted version of ai05s/ai05-0253-1.txt version 1.4
Other versions for file ai05s/ai05-0253-1.txt

!standard 3.10.2(14/3)          11-07-28 AI05-0253-1/02
!class Amendment 11-06-16
!status Amendment 2012 11-07-28
!status ARG Approved 10-0-2 11-06-25
!status work item 11-06-16
!status received 11-05-13
!priority Low
!difficulty Medium
!subject Accessibility of allocators for anonymous access of an object
!summary
The accessibility level of an allocator assigned to a stand-alone object of an anonymous access type is that of the stand-alone object.
!question
Consider the following two allocators
declare X : access Designated := new Designated; begin X := Some_Global_Variable'access; X := new Designated;
It seems clear that the accessibility level of the allocated objects should be that of X (just as it was in Ada05), but that's not what the current wording of the Standard says.
It appears to say that the accessibility level of each allocated object is that of X's anonymous access type, which is determined by the value most recently assigned to X (which is well-defined but silly for the second allocator above and not even well-defined for the first allocator).
Should this be changed? (Yes.)
!proposal
(See wording.)
!wording
Insert immediately prior to the last sentence of 3.10.2 (14/3):
For an anonymous allocator whose type is that of a stand-alone object of an anonymous access-to-object type, the accessibility level is that of the declaration of the stand-alone object.
!discussion
Obviously, this needs to be defined, and the level of the declaration is the only reasonable choice.
!corrigendum 3.10.2(14/2)
Replace the paragraph:
by:
!ACATS test
Create an ACATS C-Test to test this case.
!ASIS
No ASIS impact.
!appendix

From: Steve Baird
Sent: Friday, May 13, 2011  12:37 AM

Consider the following two allocators

   declare
     X : access Designated := new Designated;
   begin
     X := Some_Global_Variable'Access;
     X := new Designated;

It seems clear that the accessibility level of the allocated objects *should* be
that of X (just as it was in Ada05), but that's not how I read the current RM
wording.

It appears to say that the accessibility level of each allocated object is that
of X's anonymous access type, which is determined by the value most recently
assigned to X (which is well-defined but silly for the second allocator above
and not even well-defined for the first allocator).

Is there general agreement that the current RM wording needs fixing to preserve
Ada05's handling of the case of an allocator which is assigned to a stand-alone
object of an anonymous access type?

****************************************************************

From: Tucker Taft
Sent: Sunday, May 15, 2011 10:40 AM

Yes, I agree the level of an anonymous allocator in this context should remain
local.

****************************************************************

From: Gary Dismukes
Sent: Saturday, June 25, 2011  9:31 AM

Proposed wording for AI05-0253-1 (accessibility of anonymous allocators)

!summary

The accessibility level of an allocator assigned to a stand-alone object
of an anonymous access type is that of the stand-alone object.

!wording

Insert immediately prior to the last sentence of 3.10.2 (14/3):

For an anonymous allocator whose type is that of a stand-alone object of
an anonymous access-to-object type, the accessibility level is that of the
stand-alone object.

****************************************************************



Questions? Ask the ACAA Technical Agent