[Ada] Spurious error when instance of generic is used as formal package
authorEd Schonberg <schonberg@adacore.com>
Tue, 9 Jul 2019 07:54:05 +0000 (07:54 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 9 Jul 2019 07:54:05 +0000 (07:54 +0000)
commita74d1bf6af0aaeb693cdbddf924c9af53f92b549
tree9ab3bec342e407244ab1494d783dc5695742b9bb
parent554a9844f74932d2c6e9a690d04bfd96b361055b
[Ada] Spurious error when instance of generic is used as formal package

This patch removes a spurious bug on the use of the current instance of
a generic package G as the actual in a nested instantiation of a generic
unit GU that has a formal package whose generic_package name is G. This
is only legal if G has no generic formal part, and the formal package
declaration is declared with a box or without a formal_paxkage_actual
part.

2019-07-09  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch12.adb (Instantiate_Formal_Package): Handle properly the
case where the actual for a formal package in an instance is the
current instance of an enclosing generic package.
(Check_Formal_Packages): If the formal package declaration is
box-initialized or lacks associations altogether, no internal
instance was created to verify conformance, and there is no
validating package to remove from tree.

gcc/testsuite/

* gnat.dg/generic_inst5.adb, gnat.dg/generic_inst6.adb,
gnat.dg/generic_inst6_g1-c.adb, gnat.dg/generic_inst6_g1-c.ads,
gnat.dg/generic_inst6_g1.ads, gnat.dg/generic_inst6_i1.ads,
gnat.dg/generic_inst6_i2.ads, gnat.dg/generic_inst6_x.ads: New
testcases.

From-SVN: r273275
gcc/ada/ChangeLog
gcc/ada/sem_ch12.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/generic_inst5.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst6.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst6_g1-c.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst6_g1-c.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst6_g1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst6_i1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst6_i2.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/generic_inst6_x.ads [new file with mode: 0644]