Commit 28541488 by Javier Miranda Committed by Arnaud Charlet

exp_aggr.adb (Build_Record_Aggr_Code): Add implicit call to the C++ constructor…

exp_aggr.adb (Build_Record_Aggr_Code): Add implicit call to the C++ constructor in case of aggregates whose type is a...

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.

From-SVN: r147151
parent 55c078ac
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
......
......@@ -2765,6 +2765,18 @@ package body Exp_Aggr is
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;
......@@ -3129,6 +3141,13 @@ package body Exp_Aggr is
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment