!standard 03.04 (31) 99-09-15 AI95-00062/05 !standard 03.10 (07) !class binding interpretation 95-07-06 !status Corrigendum 2000 99-07-20 !status WG9 approved 95-06-14 !status ARG approved 9-0-1 95-11-01 !status received 95-07-06 !qualifier Omission !subject Derived access types share the same pool !summary A derived access type shares its parent's storage pool. !question NOTE 3.4(31) says, "If the parent type is an access type, then the parent and the derived type share the same storage pool..." This is clearly what we want, but I can't seem to prove it from the real rules (i.e. non-NOTES). !recommendation A derived access type shares its parent's storage pool. !wording (See corrigendum.) !discussion NOTE 3.4(31) makes the intent clear. Furthermore, 13.11.2(16) says, "The execution of a call to an instance of Unchecked_Deallocation is erroneous if the object was created other than by an allocator for an access type whose pool is Name'Storage_Pool." Thus, if a derived access type does not have the same pool as its parent, then the following would be erroneous: type Parent is access Integer; type Derived is new Parent; X: Derived := new Integer; Y: Parent := Parent(X); procedure Free is new Unchecked_Deallocation(Object => Integer, Name => Parent); ... Free(Y); The above was not erroneous in Ada 83. This would be a serious upward incompatibility, which there was no intention to introduce. Note that no such upward incompatibility is documented in the AARM. !corrigendum 3.10(7) @drepl There are two kinds of access types, @i types, whose values designate objects, and @i types, whose values designate subprograms. Associated with an access-to-object type is a @i; several access types may share the same storage pool. A storage pool is an area of storage used to hold dynamically allocated objects (called @i) created by allocators; storage pools are described further in 13.11, "Storage Management". @dby There are two kinds of access types, @i types, whose values designate objects, and @i types, whose values designate subprograms. Associated with an access-to-object type is a @i; several access types may share the same storage pool. A derived access type shares the storage pool of its parent type. A storage pool is an area of storage used to hold dynamically allocated objects (called @i) created by allocators; storage pools are described further in 13.11, "Storage Management". !ACATS test Create a C-Test that checks that an item of the derived type can be allocated, converted to the parent type, and deallocated. Check that an item of the parent type can be allocated, converted to the derived type, and deallocated. !appendix !section 3.4(31) !subject Derived access types should share the same pool !reference RM95-3.4(31);6.0 !from Bob Duff !reference as: 95-5173.a Robert A Duff 95-6-26>> !discussion NOTE 3.4(31) says, "If the parent type is an access type, then the parent and the derived type share the same storage pool..." This is clearly what we want, but I can't seem to prove it from the real rules (i.e. non-NOTES). - Bob ****************************************************************