!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) @drepl @xbullet is the same as that of the access type, except for an @fa of an anonymous access type that defines the value of an access parameter or an access discriminant. For an @fa defining the value of an access parameter, the accessibility level is that of the innermost master of the call. For one defining an access discriminant, the accessibility level is determined as follows:> @dby @xbullet is the same as that of the access type, except for an @fa of an anonymous access type (an @i) in certain contexts, as follows: For an anonymous allocator that defines the result of a function with an access result, the accessibility level is determined as though the @fa were in place of the call of the function; in the special case of a call that is the operand of a type conversion, the level is that of the target access type of the conversion. For an anonymous allocator defining the value of an access parameter, the accessibility level is that of the innermost master of the call. 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. For one defining an access discriminant, the accessibility level is determined as follows:>!ACATS test Create an ACATS C-Test to test this case. !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. ****************************************************************