gcc/ada/
* sem_aggr.adb (Resolve_Delta_Array_Aggregate): For an
association that is an iterated component association, attach
the copy of the expression to the tree prior to analysis, in
order to preserve its context. This is needed when verifying
static semantic rules that depend on context, for example that a
use of 'Old appears only within a postcondition.
Assoc : Node_Id;
Choice : Node_Id;
+ Expr : Node_Id;
begin
Assoc := First (Deltas);
end if;
Enter_Name (Id);
- Analyze_And_Resolve
- (New_Copy_Tree (Expression (Assoc)), Component_Type (Typ));
+ -- Resolve a copy of the expression, after setting
+ -- its parent properly to preserve its context.
+
+ Expr := New_Copy_Tree (Expression (Assoc));
+ Set_Parent (Expr, Assoc);
+ Analyze_And_Resolve (Expr, Component_Type (Typ));
End_Scope;
end;