An AdaCore engineer noticed that the class-wide preconditions on Allocate/Deallocate_Subpool are both of the form:
Pre'Class => Pool_of_Subpool(Subpool) = Pool'Access
This precondition is commented out in GNAT. If you try to uncomment it, you get:
s-stposu.ads:78:56: error: access attribute cannot be used as actual for universal_access equality
s-stposu.ads:99:56: error: access attribute cannot be used as actual for universal_access equality
The relevant rules are in 3.10.2(2/2, 2.1/2) which state:
For an attribute_reference with attribute_designator Access (or Unchecked_Access — see 13.10), the expected type shall be a single access type A such that:
- A is an access-to-object type with designated type D and the type of the prefix is D'Class or is covered by D, or
It is hard to see how universal access would meet these requirements; universal access is the type of the parameter of the "=" operator being used in this class-wide precondition.
We could add a bullet here to specifically allow universal access as the expected type for 'Access, though that might require some thought as to whether this would make sense from a dynamic semantics point of view.
An AdaCore engineer noticed that the class-wide preconditions on Allocate/Deallocate_Subpool are both of the form:
Pre'Class => Pool_of_Subpool(Subpool) = Pool'AccessThis precondition is commented out in GNAT. If you try to uncomment it, you get:
The relevant rules are in 3.10.2(2/2, 2.1/2) which state:
It is hard to see how universal access would meet these requirements; universal access is the type of the parameter of the "=" operator being used in this class-wide precondition.
We could add a bullet here to specifically allow universal access as the expected type for 'Access, though that might require some thought as to whether this would make sense from a dynamic semantics point of view.