if Get_Aspect_Id (Ritem) in Aspect_CPU
| Aspect_Dynamic_Predicate
| Aspect_Predicate
+ | Aspect_Static_Predicate
| Aspect_Priority
then
-- Retrieve the visibility to components and discriminants
Push_Type (E);
Check_Aspect_At_Freeze_Point (Ritem);
+
+ -- In the case of predicate aspects, there will be
+ -- a corresponding Predicate pragma associated with
+ -- the aspect, and the expression of the pragma also
+ -- needs to be analyzed at this point, to ensure that
+ -- Save_Global_References will capture global refs in
+ -- expressions that occur in generic bodies, for proper
+ -- later resolution of the pragma in instantiations.
+
+ if Is_Type (E)
+ and then Inside_A_Generic
+ and then Has_Predicates (E)
+ and then Present (Aspect_Rep_Item (Ritem))
+ then
+ declare
+ Pragma_Args : constant List_Id :=
+ Pragma_Argument_Associations
+ (Aspect_Rep_Item (Ritem));
+ Pragma_Expr : constant Node_Id :=
+ Expression (Next (First (Pragma_Args)));
+ begin
+ if Present (Pragma_Expr) then
+ Analyze_And_Resolve
+ (Pragma_Expr, Standard_Boolean);
+ end if;
+ end;
+ end if;
+
Pop_Type (E);
else