-- Check restriction for standard storage pool
- if No (Associated_Storage_Pool (E)) then
+ -- Skip this check when Etype (T) is unknown, since attribute
+ -- Associated_Storage_Pool is only available in the root type
+ -- of E, and in such case it cannot not be computed (thus
+ -- causing spurious errors).
+
+ if Present (Etype (E))
+ and then No (Associated_Storage_Pool (E))
+ then
Check_Restriction (No_Standard_Storage_Pools, E);
end if;
-- This reset is performed in most cases except where the access type
-- has been created for the purposes of allocating or deallocating a
-- build-in-place object. Such access types have explicitly set pools
- -- and finalization collections.
-
- if No (Associated_Storage_Pool (T)) then
+ -- and finalization collections. It is also skipped when Etype (T) is
+ -- unknown, since attribute Associated_Storage_Pool is only available
+ -- in the root type of T, and in such case it cannot not be computed
+ -- (thus causing spurious errors). Etype (T) is unknown when errors
+ -- have been previously reported on T.
+
+ if Present (Etype (T))
+ and then No (Associated_Storage_Pool (T))
+ then
Set_Finalization_Collection (T, Empty);
end if;