[Ada] Spurious error in dispatching call with class-wide precondition
This patch fixes a spurious visibility error on a dispatching call to
a subprogram with a classwide precondition, when the call qppears in
the same declarative part as the subprogram declaration itself.
2019-08-20 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_disp.adb (Build_Class_Wide_Check, Replace_Formals): When a
dispatching call tp a subprogram with a class-wide precondition
occurrs in the same declarative part as the ancestor subprogram
being called, the`expression for the precondition has not been
analyzed yet. Such a call may appear, e.g. in an expression
function. In that case, the replacement of formals by actuals in
the call cannot use the formal entities of the subprogram being
called, and the occurrence of the formals in the expression must
be located by name (Chars fields) as would be done at a later
freeze point, when the expression is resolved in the context of
the subprogram itself.
gcc/testsuite/
* gnat.dg/tagged5.adb, gnat.dg/tagged5.ads: New testcase.
From-SVN: r274733