+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * exp_aggr.adb (Rewrite_Discriminant): Rewriting must occur only for an
+ expression referring to a discriminal of the type of the aggregate (not
+ a discriminal of some other unrelated type), and the prefix in the
+ generated selected component must come from Lhs, not Obj.
+
+2010-06-22 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch3.adb (Build_Derived_Record_Type): Fix predicate determining
+ when to freeze the parent type.
+
2010-06-22 Robert Dewar <dewar@adacore.com>
* s-rannum.adb, a-nudira.adb, types.ads, freeze.adb, sem_aggr.adb,
function Has_Default_Init_Comps (N : Node_Id) return Boolean;
-- N is an aggregate (record or array). Checks the presence of default
- -- initialization (<>) in any component (Ada 2005: AI-287)
+ -- initialization (<>) in any component (Ada 2005: AI-287).
function Is_Static_Dispatch_Table_Aggregate (N : Node_Id) return Boolean;
-- Returns true if N is an aggregate used to initialize the components
and then Present (Entity (Expr))
and then Ekind (Entity (Expr)) = E_In_Parameter
and then Present (Discriminal_Link (Entity (Expr)))
+ and then Scope (Discriminal_Link (Entity (Expr)))
+ = Base_Type (Etype (N))
then
Rewrite (Expr,
Make_Selected_Component (Loc,
- Prefix => New_Occurrence_Of (Obj, Loc),
+ Prefix => New_Copy_Tree (Lhs),
Selector_Name => Make_Identifier (Loc, Chars (Expr))));
end if;
return OK;
Mark_Rewrite_Insertion (New_Decl);
Insert_Before (N, New_Decl);
- -- In the tagged case, make sure ancestor is frozen appropriately
+ -- In the extension case, make sure ancestor is frozen appropriately
-- (see also non-discriminated case below).
- if not Private_Extension or else Is_Interface (Parent_Base) then
+ if Present (Record_Extension_Part (Type_Def))
+ or else Is_Interface (Parent_Base)
+ then
Freeze_Before (New_Decl, Parent_Type);
end if;
end loop;
end if;
- -- For the tagged case, the two views can share the same
- -- Primitive Operation list and the same class wide type.
- -- Update attributes of the class-wide type which depend on
- -- the full declaration.
+ -- For the tagged case, the two views can share the same primitive
+ -- operations list and the same class-wide type. Update attributes
+ -- of the class-wide type which depend on the full declaration.
if Is_Tagged_Type (Priv_T) then
Set_Primitive_Operations (Priv_T, Full_List);