+2018-12-11 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Array_Aggr_Subtype. Resolve_Aggr_Expr): Indicate
+ that aggregate subtype has a predicate if the component type has
+ a predicate; do not rely on exisatence of predicate function for
+ component, in case component is a type no yet frozen, for which
+ predicate function has not been created yet.
+
2018-12-11 Eric Botcazou <ebotcazou@adacore.com>
* exp_aggr.adb (Packed_Array_Aggregate_Handled): Bail out for
Set_Is_Constrained (Itype, True);
Set_Is_Internal (Itype, True);
+ if Has_Predicates (Typ) then
+ Set_Has_Predicates (Itype);
+
+ if Present (Predicate_Function (Typ)) then
+ Set_Predicate_Function (Itype, Predicate_Function (Typ));
+ else
+ Set_Predicated_Parent (Itype, Predicated_Parent (Typ));
+ end if;
+ end if;
+
-- A simple optimization: purely positional aggregates of static
-- components should be passed to gigi unexpanded whenever possible, and
-- regardless of the staticness of the bounds themselves. Subsequent
-- component assignments. If the expression covers several components
-- the analysis and the predicate check take place later.
- if Present (Predicate_Function (Component_Typ))
+ if Has_Predicates (Component_Typ)
and then Analyzed (Expr)
then
Apply_Predicate_Check (Expr, Component_Typ);
-- because the aggegate might not be expanded into individual
-- component assignments.
- if Present (Predicate_Function (Expr_Type))
+ if Has_Predicates (Expr_Type)
and then Analyzed (Expr)
then
Apply_Predicate_Check (Expr, Expr_Type);