]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Spurious error in dispatching call with class-wide precondition
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Aug 2019 09:49:56 +0000 (09:49 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Aug 2019 09:49:56 +0000 (09:49 +0000)
commitbde0f5d5e44a5e471ca9b34487d5e34331fd2c22
tree7561a4352f911447065413a2aef272765ffbead6
parent1b86a7ca39fca3fcef917fca781916fe6af374b3
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@274733 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ada/ChangeLog
gcc/ada/exp_disp.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/tagged5.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/tagged5.ads [new file with mode: 0644]