===================================================================
@@ -2694,12 +2694,11 @@
return;
-- Skip inlining if this is not a true inlining since the attribute
- -- Body_To_Inline is also set for renamings (see sinfo.ads)
+ -- Body_To_Inline is also set for renamings (see sinfo.ads). For a
+ -- true inlining, Orig_Bod has code rather than being an entity.
elsif Nkind (Orig_Bod) in N_Entity then
- if not Has_Pragma_Inline (Subp) then
- return;
- end if;
+ return;
-- Skip inlining if the function returns an unconstrained type using
-- an extended return statement since this part of the new inlining
===================================================================
@@ -3778,12 +3778,17 @@
or else Nkind (Unit_Declaration_Node (Subp)) /=
N_Subprogram_Declaration
or else No (Body_To_Inline (Unit_Declaration_Node (Subp)))
+ or else Nkind (Body_To_Inline (Unit_Declaration_Node (Subp))) in
+ N_Entity
then
Add_Inlined_Body (Subp, Call_Node);
-- Front end expansion of simple functions returning unconstrained
- -- types (see Check_And_Split_Unconstrained_Function) and simple
- -- renamings inlined by the front end (see Build_Renamed_Body).
+ -- types (see Check_And_Split_Unconstrained_Function). Note that the
+ -- case of a simple renaming (Body_To_Inline in N_Entity above, see
+ -- 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.
else
Expand_Inlined_Call (Call_Node, Subp, Orig_Subp);