[Ada] Spurious error in dispatching call with class-wide precondition
Pierre-Marie de Rodat
derodat@adacore.com
Tue Aug 20 09:51:00 GMT 2019
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.
Tested on x86_64-pc-linux-gnu, committed on trunk
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 3202 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190820/e0080964/attachment.bin>
More information about the Gcc-patches
mailing list