Expanding a function call that returns a controlled type
on the left-hand side of an assignment should be avoided.
Otherwise we will miss the diagnostic for
trying to assign something to a non-variable element.
gcc/ada/ChangeLog:
* exp_ch6.adb (Expand_Ctrl_Function_Call): Avoid expansion
of controlled types when the LHS is a function call.
return;
end if;
+ -- Avoid expansions to catch an error when the function call is on the
+ -- left-hand side of an assignment.
+
+ if Nkind (Par) = N_Assignment_Statement and then N = Name (Par) then
+ return;
+ end if;
+
-- Resolution is now finished, make sure we don't start analysis again
-- because of the duplication.