-- because the expression will not be further analyzed, and Gigi
-- considers the two types equivalent in any case.
+ -- This is not strictly the case ??? If the reference is an actual
+ -- in a call, the expansion of the prefix is delayed, and must be
+ -- reanalyzed, see Reset_Packed_Prefix. On the other hand, if the
+ -- prefix is a simple array reference, reanalysis can produce spurious
+ -- type errors when the PAT type is replaced again with the original
+ -- type of the array. The following is correct and minimal, but the
+ -- handling of more complex packed expressions in actuals is confused.
+ -- It is likely that the problem only remains for actuals in calls.
+
Set_Etype (Aexp, Packed_Array_Type (Act_ST));
+
+ if Is_Entity_Name (Aexp)
+ or else
+ (Nkind (Aexp) = N_Indexed_Component
+ and then Is_Entity_Name (Prefix (Aexp)))
+ then
+ Set_Analyzed (Aexp);
+ end if;
end Convert_To_PAT_Type;
------------------------------