]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Fix bogus visibility error with nested generics and inlining
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Sep 2019 08:14:23 +0000 (08:14 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Sep 2019 08:14:23 +0000 (08:14 +0000)
commitac42ccd18bdc5b544c858129475cb93b5a5a3594
treea0925593d1b606a60ed49952f71ea5226bb4163f
parenta98be6bcec509735b2d81b30d48f476985a41088
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@275952 138bc75d-0d04-0410-961f-82ee72b054a4
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]