+2009-05-06 Javier Miranda <miranda@adacore.com>
+
+ * exp_aggr.adb (Build_Record_Aggr_Code): Add implicit call to the C++
+ constructor in case of aggregates whose type is a CPP_Class type.
+
2009-05-06 Robert Dewar <dewar@adacore.com>
* sem_ch13.adb: Minor comment additions
end if;
end if;
+ -- For CPP types we generate an implicit call to the C++ default
+ -- constructor to ensure the proper initialization of the _Tag
+ -- component.
+
+ if Is_CPP_Class (Typ) then
+ pragma Assert (Present (Base_Init_Proc (Typ)));
+ Append_List_To (L,
+ Build_Initialization_Call (Loc,
+ Id_Ref => Lhs,
+ Typ => Typ));
+ end if;
+
-- Generate the assignments, component by component
-- tmp.comp1 := Expr1_From_Aggr;
if Ancestor_Is_Expression then
null;
+ -- For CPP types we generated a call to the C++ default constructor
+ -- before the components have been initialized to ensure the proper
+ -- initialization of the _Tag component (see above).
+
+ elsif Is_CPP_Class (Typ) then
+ null;
+
elsif Is_Tagged_Type (Typ) and then VM_Target = No_VM then
Instr :=
Make_OK_Assignment_Statement (Loc,