-- also Build_Renamed_Body) cannot be expanded here because this may
-- give rise to order-of-elaboration issues for the types of the
-- parameters of the subprogram, if any.
+ --
+ -- Expand_Inlined_Call procedure does not support the frontend
+ -- inlining of calls that return unconstrained types used as actuals
+ -- or in return statements.
elsif Present (Unit_Declaration_Node (Subp))
and then Nkind (Unit_Declaration_Node (Subp)) =
and then
Nkind (Body_To_Inline (Unit_Declaration_Node (Subp))) not in
N_Entity
+ and then Nkind (Parent (N)) /= N_Function_Call
+ and then Nkind (Parent (N)) /= N_Simple_Return_Statement
then
Expand_Inlined_Call (Call_Node, Subp, Orig_Subp);
and then Is_Unc;
end if;
+ -- Inlining function calls returning an object of unconstrained type as
+ -- function actuals or in a return statement is not supported: a
+ -- temporary variable will be declared of unconstrained type without
+ -- initializing expression.
+
+ pragma Assert
+ (not Uses_Back_End
+ or else Nkind (Parent (N)) not in
+ N_Function_Call | N_Simple_Return_Statement
+ or else not Is_Unc);
+
-- Check for an illegal attempt to inline a recursive procedure. If the
-- subprogram has parameters this is detected when trying to supply a
-- binding for parameters that already have one. For parameterless