]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Fix bogus visibility error with nested generics and inlining
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 19 Sep 2019 08:14:23 +0000 (08:14 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 19 Sep 2019 08:14:23 +0000 (08:14 +0000)
commit9e0746fcd5bb14d164d3686b0940ae7129d05231
treea0925593d1b606a60ed49952f71ea5226bb4163f
parentfd0d7b4e3be10508119636f06807f23d5691088b
[Ada] Fix bogus visibility error with nested generics and inlining

This prevents the compiler from issuing a bogus error about the
visibility of an operator in an instantiation of a nested generic
package which is itself used as an actual of an instantiation of another
generic package, when the instantiations are done in a unit withed from
the main unit and containing an inlined subprogram, and cross-unit
inlining is enabled.

In most cases, the compiler does not check the visibility of operators
in an instantiation context because this has already been done when the
generic package has been analyzed. However, there are exceptions like
the actuals of an instantiation of a generic child unit which is done
as a compilation unit and the In_Instance predicate has a special check
for these cases.

This check would incorrectly trigger here and needs to be tightened.

2019-09-19  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* sem_util.adb (In_Instance): Test whether the current unit has
been analyzed instead of being on the scope stack to detect the
case of actuals of an instantiation of a generic child unit done
as a compilation unit.

gcc/testsuite/

* gnat.dg/inline20.adb, gnat.dg/inline20_g.adb,
gnat.dg/inline20_g.ads, gnat.dg/inline20_h.ads,
gnat.dg/inline20_i.ads, gnat.dg/inline20_q-io.ads,
gnat.dg/inline20_q.ads, gnat.dg/inline20_r.ads: New testcase.

From-SVN: r275952
gcc/ada/ChangeLog
gcc/ada/sem_util.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/inline20.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline20_g.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline20_g.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline20_h.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline20_i.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline20_q-io.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline20_q.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/inline20_r.ads [new file with mode: 0644]